Logo

Wagtail code highlighting

Jan. 12, 2026

Today I added code support to my blog. So that I can share code snippets.

In order to achieve the desired outcome, I had to take a few steps.

  1. Convert my richtextfield to a streamfield.
  2. Added a CodeBlock provided by wagtailcodeblock.

The tricky bit was to reuse the existing content and to migrate all the necessary content which already existed to become part of the streamfield.

Eventually it all worked out:

print("Hello world")

Do you also want code blocks with highlighting added to your existing wagtail website? Get in touch! 😊

Return to blog