我不明白的是:某些关键字似乎是为 DocPad 保留的,例如 @document,哪些词可以让我使用自定义数据值?
例如我正在使用
<%= data.hostimagesurl %>
但我见过
<%= page.hostimagesurl %>
和
<%= site.hostimagesurl %>
也在用,可以补吗?我必须使用某些值吗?
我不明白在哪里可以发现陷阱,是否允许使用连字符和下划线?
我想象这就像把手一样工作,我定义标签输入值并且它只是工作 - 这种思维方式正确吗?
我也很困惑为什么我的 DocPad 布局不起作用。我只是收到一个错误
error: Something went wrong while rendering: /Users/***/my-new-website/src/render/index.html
The error follows:
ReferenceError: document is not defined
at Object.eval (<anonymous>:55:29)
at Object.eval (<anonymous>:67:8)
at eval (<anonymous>:69:6)
at Function.eco.render (/Users/***/my-new-website/node_modules/eco/lib/index.js:26:25)
at EcoPlugin.render (/Users/***/my-new-website/node_modules/docpad-plugin-eco/out/eco.plugin.js:23:32)
at ambi (/Users/***/my-new-website/node_modules/event-emitter-grouped/node_modules/ambi/out/lib/ambi.js:57:27)
at Task.<anonymous> (/Users/***/my-new-website/node_modules/event-emitter-grouped/out/lib/event-emitter-grouped.js:45:23)
at ambi (/Users/***/my-new-website/node_modules/ambi/es5/lib/ambi.js:98:14)
at Domain.fireMethod (/Users/***/my-new-website/node_modules/taskgroup/out/lib/taskgroup.js:397:23)
at Domain.run (domain.js:228:14)
at Task.fire (/Users/***/my-new-website/node_modules/taskgroup/out/lib/taskgroup.js:435:27)
at Immediate._onImmediate (/Users/***/my-new-website/node_modules/taskgroup/out/lib/taskgroup.js:452:26)
at processImmediate [as _immediateCallback] (timers.js:383:17)
我可以看到的第一个错误发生在这一行:
background-image:url(<%= data.hostimagesurl %>bg.gif);
<body style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;min-width:100%; color:#353535; background-color:#f9f9f9; background-image:url(<%= data.hostimagesurl %>bg.gif); background-repeat: repeat; background-position:center top; font-family: Helvetica, sans-serif; font-size:13px; margin: 0; padding: 0;" yahoo="fix" bgcolor="#f9f9f9">
我的渲染 index.html 文件如下所示:
---
title: "Welcome!"
layout: "default"
isPage: true
hostimagesurl: "http://www.googel.com/"
---
<p>Testing 1</p>
我到底做错了什么?