【发布时间】:2019-11-16 01:20:12
【问题描述】:
我知道如何使用apostrophe-custom-pages 将字段添加到pages,但不知道如何将字段x 仅添加到页面模板a 和字段y 仅添加到页面模板b在beforeConstruct 方法中。我将console.logged 两个self 和options 参数都传递给了函数,但从未在日志中看到模板名称(因此允许我在beforeConstruct 方法中运行逻辑。有没有办法完成这个?
【问题讨论】:
-
是否有两个不同的
apostrophe-custom-pages子类是您想要避免的事情? -
不,只是不确定如何构造多个
apostrophe-custom-pages子类。目前,我只是通过将我自己的实例添加到lib/modules来扩展apostrophe-custom-pages,这显然适用于我在lib/modules/apostrophe-pages中的工作,其中存储了我的其他模板。我是否会在lib/modules中创建一个新模块,并使用module.exports = { extend: 'apostrophe-custom-pages',...进行初始化?如果是这样,我该如何包含对这个新模板的引用?进行快速测试,并将其添加到apostrophe-pages/index会引发未找到错误。
标签: apostrophe-cms