Log in Sign up

Empty summary metadata is rendered as the text 'null'?

By default, I include a "Summary:" line in post metadata. I don't always add a Summary, but if I leave it empty it renders {{summary}} as null in the template. I tried adding a conditional like so:

{{#summary}}{{summary}}{{/summary}}

...but that still renders as null unless I remove the Summary line from the front matter completely.

I'd prefer it if I could leave an empty Summary: value in the post metadata without it rendering as null. Possible?


9 months ago, 5 replies   metadata   yaml   bug   resolved   Edit question

If you include the metadata key Summary in your post but leave its value empty, then your Summary will be empty rather than default to the auto-generated summary.

Out of interest, why do you want to leave the Summary key in your metadata, if you're not going to specify a summary?

Answered 9 months ago · Edit answer

Fair question. When I generate front matter it includes a Summary: line (as a reminder to write one). For some posts I don't know what that summary might be so, so I leave it empty until later. Then, I sometimes forget to go fill it in or remove it :).

I'm fine with making sure I remove the empty ones. I just thought the templates could render an empty string rather than null. No biggie, though, thanks!

Answered 9 months ago · Edit answer

Oh I see, you get the literal text string "null" rather than simply an empty summary. Well that's a bug, which I will fix

Answered 9 months ago · Edit answer

This is now fixed, if you edit the posts to trigger a rebuild you should get an empty Summary rather than the text 'null'. Thanks for the report!

Answered 9 months ago · Edit answer

Excellent, thank you!

Answered 9 months ago · Edit answer