Blot

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?

Asked 3 years ago Edit
5 replies

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?

3 years ago Edit

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!

3 years ago Edit

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

3 years ago Edit

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!

3 years ago Edit

Excellent, thank you!

3 years ago Edit

Your reply