linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

How can one access page properties (rather than post properties)? #319

Closed chgeuer closed 9 years ago

chgeuer commented 9 years ago

In the app/templates/wrapper.us file, I can spit out site-wide properties with

<div><%= JSON.stringify(site) %></div>

Now I'm using lineman.js both with the markdown blog (posts), but I also have markdown files in app/pages/*.md. When rendering the .us files, how can I access data from the page's YAML front matter / header? Trying JSON.stringify(page) claims that 'page is not defined'.

davemo commented 9 years ago

Hi @chgeuer you can access individual post metadata from the header using <%= post %> in your templates. I'm not sure you can do the same thing in a page, what kind of metadata are you putting into the header of your page template that you'd want to access?

(see https://github.com/testdouble/double-takes/blob/master/app/templates/post.us for an example of how we reference post metadata from the yaml header in our company blog).