Developing Our Blog

Finally, we're ready to install Kirby, the handy flat-file CMS we have chosen for this tutorial, and take it for a test drive.

Requirements

In terms of system requirements, we don't need much to jump off. A current version of PHP (5.3+) should be installed on our system. Feel free to use the popular MAMP / XAMP packages - because they also bring a local webserver and other useful stuff. Alternatively, with PHP 5.4 or newer, you can also start a webserver via command line.

Besides that, we’ll use the Git version control system to manage our code. Therefore, make sure you either have Git installed on your system or use a desktop GUI like Tower.

Note

Don't despair if you don't know anything about Git or version control. You won't need a deep knowledge of Git to follow - which makes this the perfect occasion to start learning it. There's a complete online book that is tailored to beginners - and it's free!

Cloning the Kirby “Starterkit”

Using Git with Tower Command Line

The “Starterkit” repository is the quickest way to get going with Kirby. In Tower, go to the “Repositories” view and click the “Clone” button. In the dialog, enter the following URL:

https://github.com/getkirby/starterkit

…and select a local folder where you want the project cloned to.

After the download has completed, you can double-click the repository in the sidebar to open it in Tower - or have a look at it in a file browser.

The “Starterkit” repository is the quickest way to get going with Kirby. On the command line, move into the directory where you keep your development projects. There, execute the following command:

$ git clone https://github.com/getkirby/starterkit

After the download has completed, you can have a look at the new folder in your file browser.

You should now have the following files on your disk:

Kirby Project Structure

Let's take a quick tour of the most important parts in a Kirby project:

assets

The assets folder will host our CSS, Javascript, and images. If your project contains additional resources (like fonts, downloads, etc.) they will also be placed here.

content

This is where our actual pages will live. To understand Kirby's logic (which is, luckily, very simple), have a look at the example structure:

Each folder represents a single page. Folder names can be prepended with numbers which are used to sort items (for example when used in a site navigation). Folder names also map to URLs: in this example structure, you can browse to a "projects/project-b" page.

Inside a folder, a simple ".txt" file hosts the page's contents. The file's name is not arbitrary: it determines which template file is used to render the contents. In this case, Kirby will look for a template named "project" (or take a default template if can't find it). Also, any images or other media files are placed inside the page folder.

kirby

The kirby folder contains the actual Kirby system files. It's best to keep our hands off this folder and its contents - and let Kirby do its magic.

panel

The same goes for the panel folder: this is also a system component that we should not directly mess with.
The panel provides a management interface for our contents. You can configure it for users that shy away from using Markdown for content editing.
We won't make use of the panel in this tutorial.

site

This is where we'll spend the majority of our time developing the site.

We'll explore this area in detail later, but let's quickly explain what the folders are there for:

  • accounts is where Kirby's user management happens. Since, as said, we won't use Kirby's Panel, we won't need this either.
  • blueprints is also only necessary when you use Kirby's Panel frontend. In short, this is where you configure data entry masks for different page structures.
  • cache is where cache data is kept. Kirby has an excellent little caching system that boosts your site's speed.
  • plugins can host any add-ons to Kirby's core funtionality, like a search or a tag cloud generator for example.
  • snippets holds smaller, reusable parts of your templates. Instead of large, monolithic templates it's better to split them into smaller units that promote reuse and a better overview.
  • templates will contain one file for each of the main page types we'll have.

thumbs

This is where Kirby places generated thumbnail images from your content (which is not relevant in this tutorial).

license.md

While we're at it: if, after this tutorial, you're just as happy with Kirby as we are, please consider supporting the developer and purchase an (inexpensive) license key for your Kirby project.

Let’s get done with the project setup so we can start developing!

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.