Log in Sign up

Unable to get custom metadata to show up

I've set custom metadata for one of my posts, as per this doc. In this case, it is for describing magic spells. The metadata is as follows:

title: Magic Spell 
tags: spell
date: 2023-01-16
isSpell: yes
magicWord: boo

Now, I want to have this custom metadata show up, only for posts where the isSpell: metadata is set to yes. So I've modified my entry.html template as follows

{{#entry}}
    {{#metadata.isSpell}}
        {{metadata.magicWord}}
    {{/metadata.isSpell}}
     {{{html}}}
 {{/entry}}

But when I go to the corresponding post, I can't see the Magic Word. I've added ?debug=true to the URL and I can see the metadata in the JSON, so I'm not sure what I'm doing wrong here.


10 months ago, 2 replies   bug   metadata   Edit question

I might have sorted this. It seems that using camelCase metadata names causes them to not work. By using all lowercase, such as isspell and magicword, I can get it to work.

Answered a year ago · Edit answer

Good catch, Blot lowercases custom metadata keys before exposing them to template views. This was a poor decision I made a long time ago. I'll make sure the original case is also exposed, so you can use camelCase metadata keys

Answered 10 months ago · Edit answer