Your sites Log in Sign up Menu

Metadata in a markdown file

If I have something in my YAML front matter, can I display that in my post? This does not seem to work when placed in the markdown file.


Date: September 15th, 2022
blah: Apple


{{metadata.blah}}


2 years ago, 5 replies   Improve this question

Figured it out {{entry.metadata.blah}}

Answered 2 years ago · Improve this answer

Excellent, yes, {{metadata}} is a part of the {{entry}}. All these lines produce the same result:

- {{entry.metadata.blah}}
- {{#entry}} {{metadata.blah}} {{/entry}}
- {{#entry.metadata}} {{blah}} {{/entry.metadata}}
Answered 2 years ago · Improve this answer

This is great. Is there any way to tie a CSS selector to this data in order to style it? I'm thinking about using the summary metadata after the title at the top of the post and want it to stand out. Thanks!

Answered 2 years ago · Improve this answer

You could just wrap it in a span

<style>#styleMe {color:red;}</style> 
<span id="styleMe">{{entry.metadata.blah}}</span>

or do it all in one line

<span style="color:blue;">{{entry.metadata.blah}}</span>    
Answered 2 years ago · Improve this answer

Thank you! I wrapped it in a div instead to get a nice bottom border, but used the same pattern.

Answered 2 years ago · Improve this answer