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?
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?
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 answerOh 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 answerThis 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!