How to Model a Blog Post
A well-structured custom types for a piece of editorial content will provide flexibility for content teams to mix and match components with slices to build a blog post or an article featuring text sections, images etc.
Page structure
Static Fields
Dynamic Zone
Every blog post will need a title, so we will make this a static field. For this we will use a:
- Title field
< PreviousNext >
You will need a release date, so we will make this a static field. We will use a:
- Date field
< PreviousNext >
It is common practice to have an author as well. We will use another Custom Type "Author" for this and link them through a:
- Content Relationship field
< PreviousNext >
This content block will consist of a:
- Text field to allow the authors to add their text content
< PreviousNext >
This content block will consist of a:
- Text field
< PreviousNext >
This content block will consist of:
- Image field for the image
- Text field for the caption
< PreviousNext >
How to set it up in Prismic
- Create a new repeatable Custom Type
- Copy the JSON below and paste it under the "JSON Editor" of this new Custom Type
Copy
{ "Main": { "title": { "type": "StructuredText", "config": { "single": "heading1", "label": "Title", "placeholder": "Blog post title..." } }, "release_date": { "type": "Date", "config": { "label": "Release Date" } }, "author": { "type": "Link", "config": { "select": "document", "label": "Author", "placeholder": "Link to an author document" } }, "body": { "type": "Slices", "fieldset": "Slice zone", "config": { "choices": { "text": { "type": "Slice", "fieldset": "Text", "description": "A rich text section", "icon": "text_fields", "non-repeat": { "text": { "type": "StructuredText", "config": { "multi": "paragraph, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, list-item, o-list-item", "allowTargetBlank": true, "label": "Text", "placeholder": "Enter your text..." } } }, "repeat": {} }, "quote": { "type": "Slice", "fieldset": "Quote", "description": "A featured quote", "icon": "format_quote", "non-repeat": { "quote": { "type": "StructuredText", "config": { "single": "paragraph, strong, em", "label": "quote", "placeholder": "Enter quote..." } } }, "repeat": {} }, "image": { "type": "Slice", "fieldset": "Image", "description": "An image with optional caption", "icon": "image", "non-repeat": { "image": { "type": "Image", "config": { "constraint": {}, "thumbnails": [], "label": "Image" } }, "caption": { "type": "StructuredText", "config": { "single": "paragraph, strong, em, hyperlink", "allowTargetBlank": true, "label": "Caption", "placeholder": "Optional image caption..." } } }, "repeat": {} } } } } } }
See More
What editors will see
How to model content for your project
Sarah will be glad to help you come up with a solid content model for your project. (It’s free.)
Attend one of her upcoming live Crash Course