Bold text in a blog post description

I would like to have text in the description of my blog post, displayed as HTML in the indexes and escaped in the page meta description.

When the description is inserted the HTML is not parsed. I tried with {{ .Description | html }} but that does not work. I also tried using ** but that failed too.

Any suggestions?

Let’s say you have the following in your .yaml front matter for a page…

description: Here is a description for my page with some **bold** and *italics* text.

If you want to convert the markdown somewhere within the <body> of your html page, use the following:

{{.Description | markdownify}}

If you want to add the same description to a <meta> tag, you can first convert it to HTML and then remove all the tags using | plainify:

<meta name="description" content="{{.Description | markdownify | plainify}}">

Make sure to pipe the description through markdownify first or you will get the asterisks in your meta description.


It works fine. Thanks ! :slightly_smiling:

1 Like