Site / Creating a site

History, once

Declare which moves add a browser history step and which replace the current entry once per node. Moving to another node — or from an unknown URL so Back returns there — always pushes. Within one node, configure history as 'push', 'replace', or a comparison function:

ts
const PersonNode = Site.route(personRouter, AppRoute.Person, {
  // Moving to another person pushes; changing sub-view params replaces.
  history: (prev, next) => (prev.personId === next.personId ? 'replace' : 'push'),
})

const onePersonTarget = Site.target(PersonNode, { personId: 1 })
const anotherPersonTarget = Site.target(PersonNode, { personId: 2 })
const samePersonTarget = Site.target(PersonNode, { personId: 1 })

Site.historyOf(onePersonTarget, anotherPersonTarget) // 'push'
Site.historyOf(onePersonTarget, samePersonTarget) // 'replace'

Use foldkit-mirror per-key URL mirrors for plain fields like filters or tabs, and routed params for transitions handled by update.