pmoreno
1
Hi.
I have this code in a template:
<p class="excerpt">
{{ page.content|raw }}
</p>
In the html output I get the following result:
<p class="excerpt">
<p>Content paragraph here...</p>
</p>
I’d like to get only one paragraph with its css classes (in this example “excerpt”)
how can I get it?
Thanks.
b.da
2
Hi @pmoreno
how about using a custom theme variable?
otherwise what you can try
1.use striptags twig filter
<p class="excerpt">
{{ page.content|striptags|raw }}
</p>
or
2. disable markdown process for the entire page
if there are no more markdown on the page
set through admin panel or in page .md file
process:
markdown: false
twig: true
pmoreno
3
Thanks @b.da
It is a good solution if no html tag is included in the content. Otherwise another solution would be to wrap page.content in a div tag.