What I don't understand: certain keywords appear to be reserved for DocPad like @document, which words let me use custom data values?
e.g. I'm using
<%= data.hostimagesurl %>
but I've seen
<%= page.hostimagesurl %>
and
<%= site.hostimagesurl %> 
also in use, can I make these up? Are there certain values I have to use?
I don't understand where I can discover the pitfalls, are hyphens and underscores allowed?
I'm imagining this works like handlebars, I define the tag enter the value and it just works - is this way of thinking correct?
I'm also confused to why my DocPad layout isn't working. I'm just getting an error
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)
The first error I can see happens on this line:
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">
My render index.html file looks like:
---
title: "Welcome!"
layout: "default"
isPage: true
hostimagesurl: "http://www.googel.com/" 
---
<p>Testing 1</p>
What on earth am I doing wrong?
 
                        
In your example you've made the classic DocPad error of forgetting the
@symbol when referring to the current document:@documentis defined butdocumentisn't.Likewise, to access
hostimagesurlyou would need to call@document.hostimagesurlBy default two objects are passed to a DocPad template/page/layout. The
templateDataproperty defined in the docpad.coffee file and the current document object. These objects are properties of the templatethiscontext. In the case oftemplateDataeach of its properties are a member of thethiscontext, whereas the document itself is a property ofthis.In CoffeeScript and the CoffeeScript based template system, ECO,
thisis referred to by the@symbol.What this means is that within an ECO template you access the current document with
@document. You can also access@site.urlor@getPreparedTitle()which are defined in the docpad.coffee file as part of thetemplateData.The properties defined in the metadata section of your doc (between the
---) are available as properties of the document object.Quite often people will create variables like
pagewhen looping through a collection. These local variables don't need thethiscontext. Typically something like this: