Content in Kirby

August 4th, 2016

How content is stored

In Kirby, content is stored within the /content directory, where every page is a folder. Pages can be nested, so every of those pages/folders may also contain subfolders.

Take this blog demo for example; all posts are just subfolders of the blog folder. This comes with great flexibility, because it is very easy to mix different kinds of content. In this demo, the blog only has one template for articles and a corresponding blueprint file (/site/blueprints/article.yml) to provide the correct fields in the Panel when editing the content. But if you need different fields for video posts, gallery posts etc. you can extend the blog’s functionality by adding corresponding blueprints and templates to define those post types. You needs tags? Easy as pie! Just add a tags field to your article.yml blueprint.

But if you don’t use the Panel, you also don’t need to setup blueprints at all. That’s Kirby’s advantage: The content files can be edited directly if you want to.

Kirbytext

Kirby’s content is written Kirbytext by default. It is basically an extended version of Markdown or Markdown Extra. In addition to Markdown’s simple syntax, Kirbytext also includes a bunch of useful tags. For example, to link to an email address, you can use Kirby’s email tag:

(email: hello@example.com)

It is not only handier than typing “<a href="mailto: …”, but also encodes every character of the provided email address as an HTML entity to make the life of spambots a little harder. You can also define your own Kirbytags and even override the behavior of Kirby’s built-in tags. Your custom tags will be stored within /site/tags.


Further reading