How to model a list of paragraphs?


I’m new to Contentful and this is a basic question, sorry for that.

We want to use Contentful to write and display articles. An article contains a list of paragraphs, each paragraph is illustrated by an image.

How should we model that? Should we create a “paragraph” type containing a text field and an image field, then in the “article” type create a list of references to paragraphs? Is there a simpler way?

I guess we could also only create a single big markdown field containing the paragraphs and their images but this would complicate the styling on rendering.

Thanks for your help.

Hi @thomaslule,

For most use cases, the best practice for an “article” content model would be to simply structure the bulk of your content in a “body” long-text field.

With a long-text field, you’re able to add as many paragraphs and images as you want, without the need of later connecting each of them.

Also, regarding this:

You could actually structure CSS properties around your Markdown content.

Let me know if that makes sense or if I’m missing something :slight_smile:

1 Like

Hi and thanks for your answer!

Could you elaborate on this:

You could actually structure CSS properties around your Markdown content.

My problem is: I want some images to be aligned on left, other to be aligned on right, other to be full-width… Does Contentful support <img /> tags in markdown so I can use css classes directly?

EDIT: ok I just read that Markdown supports inline HTML tags so I guess that’s what you meant, thanks again!

@thomaslule That is correct! You could indeed add inline HTML tags and associate CSS properties on that. Also, we don’t enforce a given syntax in our long-text fields, but it might not be the best idea to use <img /> tags, especially if your Markdown processor cannot render HTML directly.

1 Like