Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll post.content output is surrounded by <p> tag

Tags:

jekyll

liquid

When I print the content of the post with

{{ post.content }}

It is outputted like:

<p>Lorem ipsum...</p>

How can I remove the <p> tag when generated. I need it to be removed before JavaScript starts to process the DOM.

like image 268
Ali Ismayilov Avatar asked Jul 28 '13 21:07

Ali Ismayilov


2 Answers

Jekyll automatically wraps content in p tags. You can remove those tags with a liquid command. Per Jekyll's documentation:

Because Jekyll grabs the first paragraph you will not need to wrap the excerpt in p tags, which is already done for you. These tags can be removed with the following if you’d prefer:

{{ post.excerpt | remove: '<p>' | remove: '</p>' }}

Hope this helps!

like image 147
ughitsaaron Avatar answered Nov 24 '22 00:11

ughitsaaron


I changed the post file's extension from .md to plain old .html

like image 34
Ali Ismayilov Avatar answered Nov 24 '22 01:11

Ali Ismayilov