Log in Sign up

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


5 replies Asked Sep 15 '22 at 12:36 · Improve this question

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

Answered Sep 15 '22 at 14:58 · 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 Sep 21 '22 at 13:33 · 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 Sep 28 '22 at 16:15 · 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 Sep 28 '22 at 16:39 · Improve this answer

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

Answered Sep 28 '22 at 17:25 · Improve this answer

Markdown allowed