Editing content
Editable data files
Editable data files
Not all content is a page. Nav menus, footer links, a small site config — these
often live in a JSON or YAML file like src/data/nav.json or src/data/footer.yaml. Orbit can give editors a
form for these files, without letting them near the rest of your code.
Declare which files are editable
List each file under data: in orbit.config.yaml:
data:
- path: src/data/nav.json # repo-relative
label: Main navigation # optional; defaults to the filename
They then appear under a Data heading in the app’s nav. Only files you list
here are editable — nothing else in the project is exposed — plus any file()
collection in your content config (one JSON or YAML file of entries), which Orbit
adds automatically under the collection’s name.
The form is inferred from the file
There’s no schema to write — Orbit reads the file’s shape:
- an object becomes a set of fields
- an array becomes an add / remove / reorder list
- each value’s type picks the control — text, number, or checkbox
A top-level object or array both work, so a nav.json that’s a bare array of
{ label, href } items is fine.
YAML files keep their comments, key order and quoting when saved — only the values an editor changed are rewritten.
JSON or YAML, not code — the .ts pattern
Orbit edits JSON and YAML, not code. If you prefer a .ts/.js data file (for
imports or types), have it import the JSON and edit the JSON:
// src/data/nav.ts
import nav from "./nav.json";
export default nav;
Saving writes the JSON back with 2-space indentation, keeping your key and array order. It’s the same principle as the rest of Orbit: edit the data, not the design.