这是我的配置文件。
docpadConfig = {
templateData:
site:
title: 'hello docpad'
getTitle: ->
@site.title
getString: ->
'just a string'
}
# Export the DocPad Configuration
module.exports = docpadConfig
当我这样做时,从玉器布局来看,title= site.title
它还可以。当我尝试调用辅助函数title= getTitle()
时,控制台输出以下内容:
error: An error occured:
ReferenceError: /Volumes/Data/project/am/lab/docpad/hello_docpad/src/layouts/default.html.jade:21
19|
20| //- Our site title and description
> 21| title= getTitle()
22|
23| //- Output DocPad produced meta elements
24| != getBlock('meta').toHTML()
site is not defined
at docpadConfig.templateData.getWat (/Volumes/Data/project/am/lab/docpad/hello_docpad/docpad.coffee:10:16)
at eval (eval at <anonymous> (/Volumes/Data/project/am/lab/docpad/hello_docpad/node_modules/docpad-plugin-jade/node_modules/jade/lib/jade.js:170:8), <anonymous>:47:64)
看起来我无法从辅助函数内部访问站点对象。
我确定我错过了一些微不足道的东西,也许需要一个插件......在这里找不到“wat”是错误的。