Accessing additional markdown metadata parameters in Wintersmith

markdown, node.js, pug, wintersmith

Solution

I think you're looking for the `page.metadata` object.

test.md

---
foo: bar
template: test.html
---

...

test.jade

h1=page.metadata.foo

Problem

I'm trying to setup a site using Wintersmith as a static site generator in Node.js. By default, articles written in markdown to be published as content in the site use a short heading section to specify some of the metadata about the article that can be used in a Jade template, for example. These attributes are grouped between two markdown horizontal rule elements (`---`): ``` --- title: README author: the-wintersmith date: 2013-04-30 template: article.jade --- Welcome to your new blog! ... ``` Out of the box, this works fine and I can do things like parse the date object, or include the author of the article, etc. But I want to also add a parameter called "thumb" that would point to an image file to use as a thumbnail for the post. But simply adding the parameter above and trying to store it doesn't work and it won't be accessible that way. I've seen lots of people using Wintersmith where they include additional metadata parameters, but none that seem to specify how they accomplish it. How do you add additional metadata parameters for use in your Wintersmith templates?

Original source