Setting Up the Content

Updated on Jan 23, 2025

After installing Craft CMS on your system, the next step is to set up some content models! It is much easier than it sounds. In the previous parts of this tutorial, we discussed Sections, Entries, Entry Types, Categories, and Assets, and now we will put that knowledge into practice.

In this section of our example, we will show you how to set up the backend of Craft so content creation is as easy as writing and publishing your blog posts. No further hassle and no other setup is required. With that said, let us create some content models and get things going! 

Before we start sharing our blog posts on the Internet, we must first create a content model for them! In other words, a Section. This Section will be where we create Entries, which will be the blog posts themselves. For the time being, a single Section will be more than enough since all we want to do is blog.

However, we must define a few supporting structures before we can create the Section. Remember, a Section is the overarching container for our content, so we need the things that go into it first. So, with that in mind, we will start with an Asset Volume.

This post includes:

section

Asset Volume

Assets, which are your media files and documents, are organized into Volumes. Before we can start utilizing them, we need to create one such Volume. To start, go to Settings > Assets and click +New Volume. On the new page, fill in the fields with this information.

  • Name and Handle - The name for the Asset Volume in this example is Images. The Handle field will be filled in automatically when you input the name, but you can change it to anything you need;

  • Asset System - Click on +Create a New Filesystem. That will slide open a new window. Name the Filesystem Hard Disk (the Handle will fill in automatically as before);
  • Filesystem Type - There is only one type (Local Folder), so leave it as that;
  • Public URLs - Enable public URLs for this file system with the Files in This Filesystem Have Public URLs switch;
  • Base URL - Place @web/uploads/images as the Base URL for this Filesystem;
  • Base Path - Finally, place @webroot/uploads/images as the Base Path.

Save the File System and then save the Volume. You do not need to change anything else about the Volume’s settings. With that, your assets will now have a place to live on your system and in your application. Next up, we have a Category Group to organize our posts.

section

Category Group

We should create a Category Group for our posts to avoid a messy dashboard. That way, everything will be neatly organized and where it belongs. Fortunately, creating a Group is as easy as the Asset Volume from above. Go to Settings > Categories and click on +New Category Group.

  • Name - Name the Group Topics. The Handle fills out automatically;
  • Max Levels - Set it to 1;
  • Category URI Format - Define it as blog/topics/{slug};
  • Template - Set it to blog/_topic.twig.

Save your changes, and that is it! You now have a new Category Group. Still, there are a few more things we must create before the Section: Fields.

section

Fields

Earlier in our tutorial, we discussed Entries and how we use them to create our content. However, an Entry is only the scaffolding while the actual content is housed in Fields. So, let us create a few to start. We can always add more later. Go to Settings > Fields and click on +New Field

Text Fields

To begin, we will create two text fields: Summary and Post Text. Here are the steps for the Summary field.

  • Name and Handle - Set Summary as the name; the Handle field will populate on its own;
  • Default Instructions - Here, you can write something to remind you what this Field is about;
  • Field Type - Leave it as Plain Text;
  • Line Breaks and Initial Rows - Enable Line Breaks and set Initial Rows to 1.

Save this Field, then create a new one with the exact same settings, but name it Post Text instead.

Image Fields

This time, let us add two image fields so the blog post can have some images in it.

  • Name - Feature Image;
  • Handle - Automatically populated;
  • Field Type - Set the Field Type to Assets;
  • Restrict Asset Location - Enable the Restrict Assets to a Single Location option. A new option will appear under it, but leave it as it is. The Images volume should already be selected by default;
  • Subfolders - Enable subfolders from the Allow Subfolders switch and leave the path field empty;
  • Restrict File Types - Enable the Restrict Allowed File Types switch and select only Images from the list;
  • Max Relations - Set it to 1.

When done, save the field, then create a new image field with the same settings, but name it Image and set the Handle to imageBlock. That will be where we place images within the post’s contents.

Category

Finally, let us add a category block to our Entry for that Category we created earlier.

  • Name - Write Post Categories as the name;
  • Field Type - Select Categories;
  • Source - The Topics Category should already be selected by default, as that is the only one we have.

Leave everything else as it is and save the Field. With all of this preparation done, it is finally time for us to create our Section!

section

Section

To start, go to Settings > Sections and click +New Section. This Section will be the container within which all our blog posts will live. There are only a few options to set here.

  • Name and Handle - Name the Section Blog. The Handle will populate on its own;
  • Section Type - Select Channel if it is not yet selected;

  • Entry Types - Click +Create. Name it Post and select an icon and color if you would like.
    • Field Layout - Take the time to arrange the Fields we created earlier in a way that makes sense to you, then save the Entry Type;

Leave the rest of the settings as they are and save the Section. There you go! You now have everything you need to create a blog post!

section

Creating a Blog Post

Now, let us combine these separate elements and create a blog post! This is where all of the setup so far pays off! All of the elements we created will come in use not just for this one blog post, but they will be the foundation upon which you build your entire blog website. You can reuse and expand upon them as you see fit.

To begin, click on Entries in the Craft CMS dashboard. As we mentioned in a previous part of this tutorial, Entries are the individual pieces of content your website will have, like blog posts.

As you can see from the picture above, we currently have no Entries. Additionally, you have your Channels on the left, where you will see all Entries associated with that specific channel. In our case, we have only the blog one, so any Entry we create will be for that Channel. Click on +New Entry.

Here, you can create your blog post! Fill in the Fields you created earlier however you would like. If your layout does not look like ours, do not worry; the layout arrangement is entirely up to you, and you can change it anytime. That only affects the layout you see in the dashboard. The code of your template dictates where certain elements appear on the finished page. Write the title and description, upload your images, and then write some post content in the Post Text field. When you are all set, you will notice that in the top right, Craft has created a slug for the post, which will be the URL it is located under. Beneath that, you can also set the status of the blog post (enabled or disabled) and can also leave notes, which can be handy if someone else has to look at the post.

When you are all set and done, click on Create Entry. If you tried to preview the post and got an error page, do not worry. That is because we have not yet created a front end to show you the blog post. We will do that in the next section. For now, though, your first blog post is ready on the backend. Let us create a frontend not only for the post itself but for the website altogether.

On this page...