Site / Site and the Router
Side by side
| Question | Foldkit Router | foldkit-site |
|---|---|---|
| What route is this URL? | parseUrlWithFallback(oneOf(...), NotFound), routers in the order you list | The same, built from the tree: Site.parse(site, NotFound), nodes in tree order |
| What URL is this route? | Call its router: personRouter({ personId: 3 }) | Site.target(PersonNode, { personId: 3 }) gives the route value and its URL together; Site.hrefOf(site, route) builds from any route value |
| Which page is around this one? | Not asked | Site.chainOf, parentOf, ancestorsOf, sectionOf |
| What is it called? | Not asked | Site.titleOf, and Site.metaOf for the page's head |
| Where does the nav point? Which keys go there? | Not asked | Site.landing(site, section), Site.shortcuts(site, toMessage) |
| A click on a link on this origin | UrlRequest.Internal; update decides | Navigates if the tree holds the address; any other address loads the page in full |
| Add a Back step, or replace? | update picks pushUrl or replaceUrl | Declared per node; Site.historyOf decides |
| A URL change | onUrlChange; update sets the route | Sets the route field and tells the pages whose route arrived |
| The URL the Model already shows | Arrives like any other | Returns the same Model: no render, nothing told |
| What the page reads from the server | Not asked | The Surface a node names: Site.sources, Site.sourcesFor |
| Every address, for a build or a sitemap | Not asked | Site.targets(site, paths) |
| Drawing the page | Your view, matching on the route | Your view, or Site.view: the deepest node's view inside each ancestor's layout |