If you prefer to write your content files in a text editor, you can separate one field from the next with four dashes on a separate line:
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. All fields are instantly available in Kirby's templates.
When you add fields manually, there is no way to validate what you enter into each field.
Before fields are available to be filled by users in the Panel, they need to be defined for each content model. These field definitions are done in blueprints and give you full control over what sort of content each field can contain.
The Panel comes with many pre-defined field types that help with structuring your content. A full list of available field types and their options can be accessed in the Reference:
There are several plugins with custom field types available.
In general, you are free to name your fields like you want to, but there are two limitations:
- You can only use alphanumeric characters and underscores in field names.
- If you use field names that are also used by native Kirby methods, your field names will conflict with Kirby's existing methods, e.g. if you give your field the name "image", it will conflict with Kirby's
$page->image()method. If you still want to use this name for the field, you will have to call these fields differently in your templates. For details please refer to the template docs.
Field content is accessible in your templates via the field's name:
The methods that are chained to the name of the field are field methods that allow you to modify the field content in multiple ways. You can find a full list of available field methods in the Reference.
Also make sure to check out our Cookbook recipe on custom content fields.