Markdown in front matter

I was a bit surprised that none of the front matter is processed as Markdown. For example, if I have an apostrophe in the title or description, it gets rendered as a straight quote while all the apostrophes in the body text are correctly replaced with ’. Am I missing something?

You can use the markdownify template function, i.e.:

{{ .Params.description | markdownify }}
2 Likes

Perfect! Thanks.

Is there a way to prevent markdownify from wrapping it in <p> tags? I could add a CSS rule to make them do nothing, but semantically it is incorrect.

Currently no. The p tags are added by Blackfriday, but should be removed by Hugo … I guess this is a bug.

I created this:

This is now fixed in the latest Hugo source.

1 Like

Thanks @bjornerik

In your example, you use a Param containing markdown as a string. How would you do the same but with markdown from a file?

But note that the most common way to render markdown is via regular content (md) files; the above discusses how to get markdown support in template files.

Nope, this is not a bug! It’s standard behaviour for Markdown renderers. Please remove this. I’ve dissected the issue in detail on github.