Skip to main content
HydroGo
Content typesRelations, drafts and revisions

Relations, drafts and revisions

Link records to each other, add a publishing workflow and keep a history of changes.

Relations

A relation field points at another content type by its id. Use many: true for a list of targets.

YAML
# content-types/team.yaml  (target)
id: team
label: Team
title_field: name
public: true
fields:
  - {id: name, label: Name, kind: text, required: true, list: true}

# content-types/recipes.yaml  (source)
fields:
  - {id: author, label: Author, kind: relation, to: team}
  - {id: tasters, label: Tasters, kind: relation, to: team, many: true}

In the API a relation is the id of the target record; fetch it with GET /api/v1/content/team/<id> or list the target type and join on the client.

Drafts

With drafts: true every record has a status field:

StatusVisible in the public APIHow it changes
draftNo. A draft id answers 404.New records start here. Move to draft in the admin returns a record here.
publishedYesPublish in the admin.

Without drafts, a record is live as soon as it is saved (when the type is public).

Revisions

With revisions: true HydroGo keeps the last 50 saved versions of every record. The edit page lists them; each can be compared with the current record and restored. Restoring saves a new version and keeps the current status, so history is never rewritten.

Concurrent editing

Records carry a version number. An update must send the version it was based on; if someone else saved in between, the server rejects the write with a conflict instead of overwriting their change. The admin shows who else is editing a record.

Recommended defaults for editorial content: drafts: true and revisions: true. For settings-like singletons (site settings, navigation) neither is usually needed.