Site / Creating a site

Server rendering a route

On the server, SSR.plan selects the route and active Site.sources, pairs them with Remote.resume(Data), and renders HTML carrying the data so the browser resumes without re-fetching:

ts
const plan = SSR.plan(App, {
  id: 'owner',
  state: Projection.pick(App.model.route),
  surfaces: Object.values(active),
  parts: [Remote.resume(Data)],
})

const render = Effect.gen(function* () {
  const rendered = yield* SSR.render(config, plan, { buildId: 'b' })
  return SSR.page(template, rendered)
})

SSR.inspect verifies that the plan covers every active Surface before serving, and staticSite builds static HTML pages, sitemaps, and robots.txt at build time.

SEO and head metadata

  • Titles: Read Site.titleOf(site, route) for your document { title, body }, navigation bars, and breadcrumbs from one source.
  • Crawlable HTML: Server rendering and staticSite emit populated HTML alongside generated sitemaps and robots.txt.
  • Rich head tags: Define meta: ({ route, model }) => Meta and indexed: false on nodes, then pass Site.metaOf(site, route, model) to your SSR plan's meta option for description, Open Graph, twitter:*, noindex, and JSON-LD tags.