编辑:解决,见下文。
无法获得漂亮的网址'使用基于Assemble.io的站点。随着assembly-middleware-permalinks注释掉它将页面组装到我指定的文件夹中(如index.html,about.html等)。
完整控制台输出:
# grunt
Running "clean:build" (clean) task
Cleaning ./dist...OK
Running "copy:assets" (copy) task
Created 2 directories, copied 13 files
Running "uglify:vendor" (uglify) task
File ./dist/development/assets/js/components.js created: 129.64 kB → 128.88 kB
Running "sass:dist" (sass) task
File dist/development/assets/css/main.css created.
Running "assemble:pages" (assemble) task
#
我的组装任务:
assemble: {
options: {
flatten: true,
plugins: [
'assemble-contrib-permalinks',
'assemble-middleware-sitemap'
],
permalinks: {
structure: ':basename/index.html'
},
// Templates
layoutdir: opt.layouts,
partials: opt.layouts + '/partials/*.hbs',
layout: 'default.hbs',
// data: opt.data + '/*.{json,yml}',
// assets: opt.dev + '/assets',
sitemap: {
homepage: opt.homepage,
changefreq: 'monthly',
priority: '0.8',
robot: false,
relativedest: true
},
},
pages: {
files: [
{
src: opt.pages + '/*.{hbs,md}',
dest: opt.dev + '/'
},
]
}
}
答案 0 :(得分:1)
最后我已经开始工作了:
问题在于v0.4.0及更高版本的assembly-middlewear-permalinks需要Assmble v0.5.0,尚未准备好供公众使用(参见:https://github.com/assemble/assemble-middleware-permalinks和https://github.com/assemble/grunt-assemble)。
修复是安装assemble- contrib -permalinks(v0.3.6)并改为使用它。我还为可能遇到此问题的其他人更新了汇编任务代码。
答案 1 :(得分:0)
在自述文件中,您实际上想要使用以下内容:
...
permalinks: {
structure: ':basename/index:html'
},
...
以及此的捷径 -
...
permalinks: {
preset: 'pretty'
},
...
看看其中任何一个是否有效。