CpMultiplane Demo


How to create a simple blog

2019-06-24 18:17 simple blog tutorial

I like structured content, so I use one collection for all of my pages and one for all of my blog posts. In a previous post, I explained, how to setup basic pages. If you want to use the blog, you must have at least one page - but let's go step by step.

1. Create a page


2. Create a posts collection


I added the definitions to the page Definition files. You can copy and paste them into /cockpit/storage/collections/posts.collection.php.

If you don't name the collection "posts", you have to go to the CpMultiplane settings and change it, e. g. to "blog".


3. Create your first blog post

Now create your first post, write a few lines and click on "Published" on the top right of your display.

4. Enable the subpage module on a page

4.1 Blog is not on the startpage

Create a page and name it "Blog"


You don't have to name it "Blog", but this is for simplicity, because the UniqueSlugs addon will automatically create a slug "blog" for it. Now enable the "Subpage Module" switch at the right sidebar. Insert the name of your posts collection and set the route. This step is not automated yet. If you have a multilingual setup, you have to set a different route for all languages, e. g. "blog" for English and German, but "blogue" for French. These routes must exist as a slug in one of your pages. That's why I wrote earlier to name the page "Blog" to let the UniqueSlugs addon take care of it.

The limit is the number of posts to show and you can reverse the order (creation date) or hide the pagination completely.


Save the page and now your first blog post should be visible. Your blog posts are available via https://example.com/blog/my-first-blog-entry

If you left the excerpt field empty, the whole blog entry will be rendered in the overview. If not, the content of the excerpt field is used.

4.2 add the latest blog entries to the start page

I expect, that you did the steps from 4.1 already and that the route "/blog" exists. Now you can include the latest x entries from your posts collection. Don't activate the pagination.


4.3 Blog is the start page

Do the same like 3.1, but change the slug of your start page to the defined route in the subpage module.

Version 0.1.3 - The current branch "master" is a few commits ahead from 0.1.3.