Skip to content

Drafts

A published document stays at its path until its draft is published. One that isn't published follows its draft at once.

Published

  • Harbour/harbour
    • Ferries/harbour/ferries

A draft is saved with the slug port

Draft saved

  • Harbour/harbourpending move to /port
    • Ferries/harbour/ferries

The draft is published

Published again

  • Harbour/port
    • Ferries/port/ferries
  • A draft’s new slug or parent on a published document is a pending move. The sidebar shows the path it plans, and it takes no path until it is published.
  • Publishing checks the planned path again, since another document may be at it by then. Two pending moves may plan the same path, and the first one published gets it.
  • A document that isn’t published follows its draft at once: saving the draft moves it and the documents below it.
  • Unpublishing, or an update through the API without draft, writes the latest draft to the document, so a pending move happens then. A restored version takes its path from its parent and slug again, and older versions keep the paths they had.

An autosave is checked like any save. A new document has no slug and no path until the autosave that gives it a title, and a draft without a slug can’t be published.

findByPath returns published documents. Pass draft: true to find the latest draft at a path:

const found = await findByPath({ draft: true, path: '/plans', payload })