Rendering RichText Content

Hello Support,

I’m trying to render content from a rich text field as body content.

I’ve just got some headings and paragraphs at the minute (see attached) but may want to have lists, images etc later on and wanted to know how to best implement this.

Currently the response outputs the HTML tags onto the page (see attached).

From the research I’ve done would this be best achieved using structured text? or is there a better option?

I’m using the Astro framework for the front end.

Any advice would be greatly appreciated!


Richard Gill

Hi @albioncircus!

You probably need to use set:html to render that raw HTML: Template Directives Reference | Docs

It’s totally fine to use a HTML field instead of Structured Text if you don’t need the power of Structured Text. However, be sure to turn on HTML sanitization to help make sure nothing dangerous gets accidentally entered/pasted into that HTML field: Multiple-paragraph text field now supports HTML sanitization

Hello Roger,

Thanks so much, ‘set:html’ worked perfectly!


Richard Gill

1 Like