Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Html tags showing in content

Started by Muut Archive 10 years ago · 4 replies · 1671 views
10 years ago

I've created listing.yaml and listing.html.twig in themes/g5_helium/custom. I'm able to use this to create a page with my custom fields, but when I view the page I can see the <p> tags being printed out as plain text. I'm using an exact copy of default.html.twig for listing.html.twig.

10 years ago

I fixed it. I needed to use {{ page.content|raw }} instead of {{ page.content }}.

10 years ago

But I don't understand why. Isn't the markup being added intentionally by the Markdown editor? Why do I need to strip it away before presenting it?

10 years ago

Markdown automatically adds paragraph tags when there are two newlines in the content. If you don't want markdown processing, you can disable it site or page-wide via:

YAML
process:
   markdown: false
10 years ago

Thanks for the reply. I understand that the paragraph tags are automatically entered, but I don't understand why I have to manually strip them in my template when markdown processing is enabled. My assumption is that I would be able to edit my content using Markdown and that's what would be printed to the template, and that the template wouldn't have to wrap the content in html markup because that's already being done by markdown: true. What am I missing in my understanding?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 672 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5336 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago