Frontmatter
The frontmatter sits at the top of every post as a list of fields, one row per key. Zeku writes ordinary YAML back to the file, so nothing about the format changes.
Fields follow your schema
Section titled “Fields follow your schema”Each field’s type comes from your collection’s schema:
| In your schema | In Zeku |
|---|---|
z.string() |
Text, with suggestions from values used elsewhere as you type |
z.enum() |
Text, listing every allowed value when you click into it |
z.number() |
Number |
z.boolean() |
Checkbox |
z.date(), z.coerce.date() |
Date, or date and time when the value has a time |
z.array(z.string()), z.string().array() |
List |
z.array(z.array(...)), z.array(z.object({...})) |
List, one item per line, each written as JSON |
tags |
Tags, with suggestions from every tag in the collection |
reference('authors') |
Text, with the ids of that collection’s entries as suggestions |
z.array(reference('authors')) |
List, with the same suggestions for each item |
image() |
Text holding the image path, with a thumbnail of the image |
Enter keeps what you typed. To take a suggestion, move to it with the arrow keys first, or click it. In a field with fixed choices, an enum or a reference, the closest match is already highlighted once you start typing.
For the most accurate types, run Update field types (astro sync) from the command palette after you change your schema, or run astro sync or astro dev yourself. Astro writes a JSON schema for each collection to .astro/collections/, and Zeku reads it. If a page’s frontmatter doesn’t match its schema, the command tells you what Astro said. While it runs, the site preview’s dev server stops and then starts again, since a sync beside a running dev server can leave it answering errors until it restarts. A field your schema requires is marked, and a key your schema doesn’t declare is flagged.
A value outside your schema’s limits gets a dotted underline as you type, with a tooltip that says by how much: text longer or shorter than .max() or .min() allows, like a description over z.string().max(160), or a number above or below them. A number field’s arrows stop at the limits. Astro fails the build on these, so it’s better to see them while you write.
Reference fields
Section titled “Reference fields”A reference() field holds the id of an entry in another collection, such as an author or a related post. Zeku suggests the ids that collection actually has:
- For a collection of pages, the id Astro gives each page: its
slugfield when it has one, or else its path, slugified. - For a data collection, such as authors or categories kept in a JSON, YAML, or TOML file, the ids the file declares.
An id that names no entry gets a dotted underline, and its tooltip says so. Astro only checks a reference when a page renders it, so a typo would otherwise fail the build long after you made it.
When the other collection’s loader has its own generateId function, Zeku can’t know its ids, since it can’t run that function. Its suggestions are then the ids your other pages already use, and nothing is underlined.
Image fields
Section titled “Image fields”An image() field shows a thumbnail of the image it points at, found from the page’s own folder the way Astro finds it, including paths that use an alias from your tsconfig.json, such as ~/assets/cover.png. When no image is at the path, the value gets a dotted underline, because Astro fails the build on a missing image(). Its suggestions are the images in your content folder, written as paths from the page, nearest first. To add a new image, paste it into the field or drop the file onto it; see Images in frontmatter.
Add, change, and remove fields
Section titled “Add, change, and remove fields”- To add a field, click Add field under the list. Suggestions come from the keys your schema declares and the keys your other posts use.
- To change how a field is edited, click the icon beside its name and choose Field type. The choice is saved in the project’s
.zeku/types.json, so it follows the project to other computers. - To remove a field, click its icon and choose Remove.
Drafts and dates
Section titled “Drafts and dates”If your collection has a draft field, the dashboard shows drafts and published posts separately. Click the Published or Draft badge on a post’s card to switch it, or change the field in the frontmatter.
Zeku finds the draft field by its name, such as draft, isDraft or published, and reads it the right way round: draft: true is a draft, and published: true is a published post. A theme that marks drafts with a word instead, like status: draft and status: published, works too: a post is published only at the published word, and one without the field counts as whatever your schema defaults to. If your theme uses another field, or reads one the other way, set Draft field and A draft has on the collection’s card in Settings > Content, and for a field that holds a word, Draft word and Published word. Clear the field to turn drafts off for that collection.
Some themes keep a page off the site until it says otherwise. Coffer publishes a note only once it has publish: true, so Zeku counts a note without the field as a draft, switching a note to published writes publish: true, and a new note starts as a draft. For any collection, the setting named after its draft field, such as Without publish, a page is, says whether a page with no draft field counts as Published or A draft, and New entries start as a draft sets how a new page begins. Both are on the collection’s card in Settings > Content.
Three settings in Settings > Usability decide how Zeku writes dates:
- Date format shapes every date Zeku writes, in moment tokens such as
YYYY-MM-DD. Astro’s schema can’t say which format a site uses, so Zeku asks. It also decides whether the date picker on an empty date field offers a time, unless your schema checks dates as text and says which it wants. - Date on publish stamps today’s date on a post when it goes from draft to published. It’s off by default.
- Stamp modified on save sets the collection’s modified date field to today every time you save. It’s off by default.
Zeku finds the modified date field by its name, such as updated, lastModified or modDatetime. To see or change it, open the collection under Settings > Content > Collections and look at Modified date field. The Set it to today when I save switch under it is the same setting as Stamp modified on save. Clear the field and Zeku stamps nothing for that collection.