Learn Wagtail CMS Course

How to Use ListBlocks to Create Repeating StreamField Content

There are times when you want to have repeating sections of content within a single StreamField. For example, adding Cards (Boostrap 4 is used in this lesson). For those who are not familiar with this design component, it's so common that once you learn about it you'll see it everywhere. It looks something like this:

card-preview.png

Image on top, some text for a title, some text for a description and sometimes a button.

Making one of these in a StreamField is easy for us (if it's not you should probably watch the other videos in this Learn Wagtail video series).

In this video we tackle the idea of creating multiple cards, over and over, but with different images, titles, text, and button URLs.

3-card-preview.png

How do we create a StreamField with 3 cards with different images, titles, text buttons? ListBlock!

The Git Commit

Everything we changed from the previous lesson up until the end of this video can be found in this GitHub commit.