/ News

Custom Metadata

August 26, 2015

You can now specify your own metadata inside blog posts. For instance, if you put at the top of your post’s file:

Thumbnail: /public/test.jpeg

You can access this variable from your template like so:

{{#entry}}
  <img src="{{metadata.thumbnail}}" />
  ...

The possibilities are infinite! One thing to note – metadata keys are case insensitive. I’d also recommend using template conditionals to prevent your layout breaking if you don’t consistently specify this metadata:

{{#metadata.thumbnail}}
  <img src="{{metadata.thumbnail}}" />
{{/metadata.thumbnail}}
    
{{^metadata.thumbnail}}
  <!-- nothing will show if you didn't specify a thumb -->
{{/metadata.thumbnail}}