Post.summary includes <p> tag -- intentional or bug?

I am trying to stylize my homepage. I’m using the <!-- more --> tag to get a summary and {{ post.summary | markdown | safe }} in the macros.html as recommended in the docs. The problem is that the formatted text comes with a <p> opening tag at the beginning, e.g.

{{ post.summary | markdown | safe }}

becomes

<p> This is the first line of my blog post. You have no idea what's coming next...

and without the closing </p> tag.

This initial <p> tag is causing me formatting headaches. Why is it there, and what can I do about it?

My guess is that it’s pulling the initial HTML from the post, which includes that tag.

Thanks,

-A

Edit: solved. See below. Answer was in the docs.

I found the answer.

https://www.getzola.org/documentation/templates/overview/

{{ post.summary | markdown(inline=true) | safe }}

solves it.

1 Like