wagtail

wagtail 6.3 Internal links added to a snippet not browsable


wagtail Internal links not working for snippets with richtextfield

getting

<a id="1" linktype="page">My Page</a>.

The snippet template has {{ value.content|richtext }}

The snippet is added to our ArticlePage model by

    ('content_module', SnippetChooserBlock(ContentModule, template='domestic/blocks/article_snippet.html')),

our article_snippet.html is

{% load wagtailcore_tags %}

<div class="block-text">
    {% if not value.hide_title %}
        <h2{% if value.title_id %} id="{{value.title_id}}"{% endif %}>{{ value.title }} </h2>
    {% endif %}
    <div>{{ value.content|richtext }}</div>
</div>

our snippet is defined as

@register_snippet
class ContentModule(ClusterableModel):
    title = models.CharField(max_length=255)
    title_id = models.CharField(
        max_length=255,
        null=True,
        blank=True,
        verbose_name=_('Title ID?'),
        help_text=(
            'Your provided ID might change upon saving to ensure its valid. '
            'Check this snippet after saving to see the formatted ID.'
        ),
    )
    content = RichTextField()
    hide_title = models.BooleanField(
        default=False,
        verbose_name=_('Hide title?'),
        help_text=('Check this box to prevent the title displaying on the page.'),
    )
    tags = TaggableManager(through=ContentModuleTag, blank=True)

    panels = [
        FieldPanel('title'),
        FieldPanel('hide_title'),
        FieldPanel('title_id'),
        FieldPanel('content'),
        FieldPanel('tags'),
    ]

Solution

  • I was looking at the wrong template it was our custon filter that did not use the richtext filter - resolved now