The content folder
Kirby has no database. The content for your site is stored in the
/content folder. All you need to add and edit content is your Finder or Windows Explorer and a text editor.
A folder for every page
Every page of your site is represented by a subfolder of
/content. You can add as many subfolders and even nest them as deep as you want or need. The folder names build the URL structure for your site. Here are some examples:
As you can see, it is very easy to outline your site with this simple folder structure.
Each folder contains a text file, which stores all the data for the page. The name of the text file determines, which template should be used to render the page.
If there's no template for the text file, Kirby will use
/site/templates/default.php to render the page.
Text files are separated into data fields with a very simple format.
Title: About us ---- Intro: This is some intro text ---- Text: This is the text for the about page
Fields are divided by four regular dashes
---- Each field begins with the fieldname and a colon. The content of a field can be a single or multiple lines of text. You can store plain text, HTML, JSON, YAML or anything else, which can be written in plain text in a field.
Fields can be added or removed at any time and there's no limitation how many fields you have per text file. All fields are instantly available in Kirby's templates.
Each text file can contain its very own set of fields. You can even add different fields for text files with the same template. Together with the flexible folder structure you get a NoSQL-like data store with literally unlimited possibilities.
Visible and invisible pages
Pages in Kirby can be marked as visible by prepending a number to the folder name:
/content/1-projects /content/2-about /content/3-contact
You can use the distinction between visible and invisible pages in your templates to only show visible pages in a menu for example. Invisible pages are still accessible via their URL.
The prepended number will be stripped from the generated URLs to keep them clean.
The prepended number for visible pages also determines the order of those pages.
/content/projects/1-project-a /content/projects/2-project-c /content/projects/3-project-b
The easiest way sort visible pages in alphabetical order is by prepending a zero:
/content/physicist/0-albert-einstein /content/physicist/0-erwin-schroedinger /content/physicist/0-johannes-kepler /content/physicist/0-marie-curie /content/physicist/0-niels-bohr /content/physicist/0-nikola-tesla /content/physicist/0-stephen-hawking
For blogs or event pages a chronological order can be achived like this:
/content/blog/20121212-my-first-article /content/blog/20132206-a-second-article /content/blog/20142806-the-latest-article