TypeScript

Pages can be .ht.ts / .ht.tsx with zero configuration.

definePageModule

Helpers from sitelo/page give full type inference. At build time the import is swapped for a per-route generated module whose PageParams come from the filename: [slug] → { slug: string }, [...path] → { path: string[] }, [...path]? → { path?: string[] }.

import { html, body, h1 } from 'javascript-to-html'
import { definePageModule } from 'sitelo/page'

export default definePageModule({
  generateStaticParams: () => [{ slug: 'hello' }],
  data: ({ params }) => ({ title: params.slug }),
  render: ({ data }) =>
    html(
      body(h1(data.title))
    ),
})

Also exported: definePage, defineData, defineStaticParams.

Generated types

Declarations are written to .sitelo/types/ whenever the dev server or a build runs. Add that folder to .gitignore.