Create a Collection Type for a Post in Strapi

Daniel Phiri
InstructorDaniel Phiri
Share this video with your friends

Social Share Links

Send Tweet
Published a year ago
Updated a year ago

The first thing we want to do is model the content that will be presented on our website. To do this we'll create a Post content type that will have several fields with types including text, rich text, date, and UID.

After we create the content type you'll see how to manually create posts through the Strapi dashboard.

Instructor: [0:00] To create a new collection type, we'll click, under Plugins, on the Content Types Builder and click Create New Collection Type. We'll give our collection type the name Posts and click Continue.

[0:12] The fields of our collection type will be a text field called Title. Add another field, a date field called Date, of type date, and add another field, a rich text field called Body. We'll add another field, a text field called Author, and add another field and a UID field called Slug, that is attached to our Title field. We'll click Finish and Save and wait for our server to restart.

[0:49] We'll skip the tour. Now, if we go to our Content Manager tab, we can see that we have a Posts collection type with no entries. To add entries, click Create New Entry. We'll create an entry by Ilya Kaminsky, titled "Untitled Excerpt." We'll give this a date of May 4th, 2020, and paste this, add an author, Ilya Kaminsky, and save as well as publish.

[1:16] If we go back, we'll add another entry, we'll duplicate this, add the name, "Brown and Agile Child," add the content, change the author, Pablo Neruda, save and regenerate our slug, and save and publish.

[1:32] We'll copy this and add two more entries, "California Prodigal," paste, and add the author, Maya Angelou. We'll regenerate our slug, save, publish, and add our last entry to "Genie," date May 4th, paste our content and add our author. Our slug is generated, and so we'll save and publish.

[1:53] If we go back to our content list view, we see all our content is available. That is how you create a new collection type in Strapi and add content to it.

egghead
egghead
~ 9 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today