【发布时间】:2018-03-12 23:04:52
【问题描述】:
尝试在我的 Apostrophe 实例上遵循 creating multiple blogs 的建议流程,通过扩展 apostrophe-blog 创建新模块。我认为我正在做扩展权:我在lib/modules 中有staff-faculty-blog,在app.js 中配置了所有三个,我的应用程序运行。我去使用类型添加一个新页面,并给出template not found: pages/staff-faculty-blog-page.html。
我的问题是,我做错了什么?妈。我不太明白它为什么要搜索该名称而不是 apostrophe-blog 的工作原理——它使用索引和显示文件。起初我将视图复制到staff-faculty-blog-pages,然后没有用,所以我把它们拿出来了。还是不行。
这里有一些代码:
//staff-faculty-blog/index.js
module.exports = {
name: 'staff-faculty-blog',
alias: 'staff-faculty-blog',
label: 'Article',
extend: 'apostrophe-blog',
};
//staff-faculty-blog-pages/index.js
module.exports = {
name: 'staff-faculty-blog-page',
label: 'Staff & Faculty Blog',
extend: 'apostrophe-blog-pages'
};
//staff-faculty-blog-widgets/index.js
module.exports = {
label: 'Blog Widget',
extend: 'apostrophe-blog-widgets'
};
//app.js
var path = require('path');
var apos = require('apostrophe')({
shortName: 'fun-with-apostrophe',
bundles: ['apostrophe-blog'],
modules: {
'apostrophe-pieces-import': {},
'apostrophe-blog': { contextual: true },
'apostrophe-blog-pages': {},
'apostrophe-blog-widgets': {},
'staff-faculty-blog': { contextual: true },
'staff-faculty-blog-pages': {},
'staff-faculty-blog-widgets': {},
'apostrophe-templates': { viewsFolderFallback: path.join(__dirname, 'views') },
'apostrophe-pages': {
filters: {
ancestors: {
children: {
depth: 2
}
},
children: true
},
types: [
{
name: 'default',
label: 'Default'
},
{
name: 'apostrophe-blog-page',
label: 'Blog'
},
{
name: 'staff-faculty-blog-page',
label: 'Staff & Faculty Blog page'
},
{
name: 'home',
label: 'Home'
},
]
},
'apostrophe-workflow': { alias: 'workflow' }
}
});
【问题讨论】: