Data files
Jekyll sites keep things like testimonials, team pages and settings in data files under _data. Mabel turns a data file into a form, so a client can edit the entries without touching YAML.
Open a data file
In Content, switch to Data files. Every .yml, .yaml, .json and .csv file in _data is listed. Open one to edit it.
You do not need to set anything up first. If a file has no saved structure, Mabel works out its fields from what is in the file each time you open it. Declaring the structure just makes the form more useful.
Declare the structure
Choose Structure on a data file. Here you describe:
- The fields on every entry. For each one, set a key, a type, whether it is required and a line of help text. Drag fields to reorder them. The order sets the order of the form.
- The storage shape. This is how the entries are laid out in the file.
Field types
| Type | Use it for |
|---|---|
| Text | A short line of text. |
| Long text | A paragraph or more. |
| Number | A number. |
| Date | A date. |
| Boolean | A yes or no switch. |
| Image | A picture from your media library. |
| Link | A URL. |
| List | Several values, such as tags or locations, shown as chips. |
| Choice | One option from a fixed set. |
| Colour | A colour value. |
You can also choose which field is used as each entry’s title in the list, such as the person’s name in a testimonials file. Text, long text, number, date and choice fields can be used for this.
Storage shapes
Choose the shape that matches how your templates read the file.
| Shape | Looks like |
|---|---|
| List of entries | - name: Joel followed by more lines, repeated for each entry |
| Keyed records | joel: followed by indented fields, one key per entry |
| Single record | name: Joel and other fields at the top level |
Mabel shows the resulting YAML as you work. Changing shape rewrites the file, so check that your templates still read it. A template that loops over a list will not read keyed records.
Structures are saved in Mabel, not in your repository. Your data file stays plain YAML.
Edit entries
Once a file has a structure, opening it shows a list of entries on the left and a form on the right. Pick an entry, fill in its fields and save. The change is committed to your repository as a normal edit to the file.
A raw YAML view is also available if you need to edit the file directly. If a file is too irregular to treat as a set of entries, Mabel falls back to the raw view instead of guessing.
Editing and structuring data files needs the Admin or Owner role. See Team and access.