Contentful is all about content. From web apps to billboards, we make sure that your content gets delivered via our CDN in a flash. But before any content can be delivered to your apps, you need to create a data model for it. A data model can be seen as information about information. Much like a database table, a content model lets you define what type of content you want to store.
Let’s say we run a bookstore. We would then have to keep track of a significant number of books. An example of a content model suitable for books would be to store information about the book’s author, the title and publication date.
In this example we’ll create a data model that is suitable for the aforementioned bookstore. We’ll go through the few steps needed to build a content model, and how we can fill that content model with content. The same content that you can later use in any of your applications.
Go to https://www.contentful.com/sign-up/ to create your free account. Then browse to https://app.contentful.com/ and log in.
A space is short for workspace. In the Contentful world, a space is where you store every piece of content that belongs to a certain project - in our case a bookstore.
To create a new space, click “Add new Space”. Give the space a good name like “My Bookstore” select "Create an empty space". Then click “Create space”.
Click the “Create a content type” button.
We’ll then create a new content type called Book.
So far we have created a space called My Bookstore, and we’ve created a “content type” called Book. The next step is to define what type of information to store for each book in our bookstore. This is done by adding fields.
We currently support a number of formats:
For our Book content model, we’ll be using two types of fields: Text and Date and time.
To add the first field, click the “Add field” button and select “Text”. Give the new field the name of “Title” and click “Create”
Add the two remaining fields, Author and Publication date, so that your content model looks like so:
Now that we have our content model in place, let’s use it to create some content. We do this by clicking the “Add Book” button.
Fill out the fields and then click the Publish button
After adding a few more books, the My Bookstore space now has five entries based on the Book content model:
By following this introduction on content modeling with Contentful you… - Signed up for a free Contentful account - Created your first space called “My Bookstore” - Put together a content type called “Book” - Populated the “My Bookstore” space with content based on the “Book” content type.
Now that we’ve created a content model along with some content, a logical next step would be to test one of our demos. Like our JavaScript API demo for example. We also have demos for other languages like Ruby and .NET.