When displaying RichTextField in Wagtail, <p> tag is attached.

When I try to display RichTextField, HTML tags are displayed

It may be a very rudimentary problem, but trying to display a RichTextField

html


{{ page.body }}

In this way, if you write it in an HTML file in the same way as CharField etc.,

<p>body content</p>

In this way, the <p> </ p> tag will also be displayed.

Solution

html


{% load wagtailcore_tags %}
...
{{ page.body|richtext }}

By writing using the richtext filter like this,

body content

I was able to display without the <p> </ p> tag.

Recommended Posts

When displaying RichTextField in Wagtail, <p> tag is attached.
When the target is Ubuntu 16.04 in Ansible
When searching is not working in GAE's Datastore
[Django] Error when SlugField is specified in .filter ()