Creating a repository for a minimalistic blog

This is a guide for creating a Prismic repository which should support a minimalistic blog. The biggest concern is designing the custom types that model the data you will store and how your documents will be shaped. We'll take care of that so you can focus on creating some fun content for your this blog project.

Create a new content repository

Start a fresh Prismic repository. It's where you will define, edit and publish all of your content.

Create a blog home custom type

Custom types allow you to define and configure fields for your content.

This blog's homepage contains a title, a description and an image, perfect for an avatar of the author. Let's create a custom type with the corresponding fields. We will only need one instance for the homepage, so we will set it up as a Single Type.

In the repository you've just created, go to Custom Types, create a new type, select Single Type, and give it a name of Blog Home. Make sure that the system automatically assigns it the API ID of "blog_home". Once created, paste the following JSON into the type editor. Save.

Copy
{
  "Main" : {
    "headline" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "heading1",
        "label" : "Headline",
        "placeholder" : "Main title..."
      }
    },
    "description" : {
      "type" : "StructuredText",
      "config" : {
        "multi" : "heading2",
        "label" : "Description",
        "placeholder" : "Sub-title..."
      }
    },
    "image" : {
      "type" : "Image",
      "config" : {
        "constraint" : {
          "width" : 140,
          "height" : 140
        },
        "thumbnails" : [ ],
        "label" : "Image"
      }
    }
  }
}

Create a blog post custom type

For the blog posts we will try to keep it simple, providing a title, post date and a rich text field that will serve as the body of each post. Finally, the UID field will allow you to assign the identifier that can be used to access each document.

We will need to be able to create more than one blog post, so this will fall into the category of repeatable type. Create a new type, select Repeatable Type, and give it the name Post. Make sure that the system automatically assigns it the API ID of "post". Once created, paste the following JSON into the type editor. Save.

Copy
{
  "Blog Post" : {
    "uid" : {
      "type" : "UID",
      "config" : {
        "label" : "UID",
        "placeholder" : "unique-identifier-for-blog-post-url"
      }
    },
    "title" : {
      "type" : "StructuredText",
      "config" : {
        "single" : "heading1",
        "label" : "Title",
        "placeholder" : "Blog Post Title..."
      }
    },
    "date" : {
      "type" : "Date",
      "config" : {
        "label" : "Date"
      }
    },
    "post_body" : {
      "type" : "StructuredText",
      "config" : {
        "multi" : "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
        "label" : "Post body",
        "placeholder" : "Content of the blog post"
      }
    }
  }
}

Since this will be a a very minimal blog, we'll be using a Rich Text field as the blog posts' body. We don't really recommend doing this for a more fully featured project since you'll miss out on the flexibility that Slices provide. But for the purposes of this guide, Rich Text should be enough.

Write some content

Start by filling in your photo, your name and a headline for your blog's home.
Go to "Content" and hit "New", choose the Blog's home type and fill it with your own content. Save and publish!
Now, write a few blog posts. Make sure to fill the mandatory UID field that is used for your post's URL. Save and publish!