Skip to content

Conversation

@eigenwijsje
Copy link
Contributor

This

  • Changes the HomePage.introduction field into a wagtail.model.fields.RichTextField
  • Updates the template to render the introduction as safe HTML and inside a <div>,
  • Adds a test that the homepage with introduction renders

Fixes: #409

@thibaudcolas thibaudcolas added the Djangonaut Space Contributions done via Djangonaut Space label Nov 21, 2025
Copy link
Member

@thibaudcolas thibaudcolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All working well! A few small changes needed

@@ -1,13 +1,14 @@
{% extends "base.html" %}
{% load manifest wagtailimages_tags wagtailcore_tags i18n %}
{% load wagtailcore_tags %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s already in the line above so not needed :)

def setUp(self):
self.homepage = HomePageFactory()
self.homepage.introduction = (
"<p><i>Want to learn more about Wagtail’s future?</i></p>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<p><i>Want to learn more about Wagtail’s future?</i></p>"
f'<p>Want to learn more about <a id="{self.homepage.id}" linktype="page">Wagtail’s future</a>?</p>'

We can get extra value here by using rich text formatting that looks different between its storage format and intended output. That way, we can check the |richtext filter is correctly being used!

@thibaudcolas thibaudcolas force-pushed the change-homepage-introduction-to-rich-text-409 branch from 2a7c9ab to 7a54fba Compare November 21, 2025 16:37
@thibaudcolas thibaudcolas merged commit 7310158 into wagtail:main Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Djangonaut Space Contributions done via Djangonaut Space

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change homepage introduction to rich text

2 participants