A Structure for Our Blog

Finally, it's time to structure our blog content. We have to think about two different aspects:

  1. How can we lay out the folder and file structure for our posts in Kirby?
  2. How can we structure each blog post file? Which data fields do we need?

Folder Structure

To keep things organized, it makes sense to put all articles in a "content/posts" subfolder. Since a sorting order is desirable, we prepend each blog post's URL with an ascending number:

The article about the "Fu Manchu" is our oldest blog post; the "Chevron" piece is our newest.

Also note that we're using the articles' titles for the content file names: inside of the "01-fu-manchu" folder, we placed a "fu-manchu.txt" file.

Of course, we won't create a separate template file for each of our posts. Instead, we're using Kirby's default fallback: if it can't find a template named "fu-manchu.php", it will go looking for a "default.php" file - which we'll create in a minute.

Post Structure

Let's take another look at the template for our article view:

Each post is made up of the following data:

  • Title
  • Teaser image
  • Publication date
  • Author information (both the name and a short bio)
  • Links for the "Recommended Reading" area
  • Textual content (possibly with images)

Modeled into a set of Kirby data fields, we could structure a post’s page file like this:

Title: The Fu Manchu
---- 
Date: 2014-11-17
---- 
Author: Ralph Grando
---- 
RecommendedReading: 
- posts/dali
    - posts/handlebar
    ---- 
    Text:

    Lorem ipsum dolor sit amet…

Having our content ready, let’s use and display it in our templates.

Giveaways. Cheat Sheets. eBooks. Discounts.
And great content from our blog!

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.