alepha@docs:~/docs/reference/primitives$
cat $sitemap.md | pretty1 min read
#$sitemap
#Import
typescript
1import { $sitemap } from "alepha/react/sitemap";
#Overview
Expose a sitemap.xml generated from the application's $page primitives.
Registers a GET /sitemap.xml route that reads every registered page at
request time and emits a standard XML sitemap. Marked static by default, so
the build prerenders it to dist/public/sitemap.xml for static deployments -
while SSR runtimes also serve it live.
The hostname comes from options.hostname, falling back to PUBLIC_URL, then
to "" (relative URLs). URLs that no page answers, a feed or an
llms.txt, are listed through options.urls.
#Options
| Option | Type | Required | Description |
|---|---|---|---|
hostname |
string |
No | Absolute base URL used to build <loc> entries (e.g |
urls |
string[] |
No | Extra URLs to list after the pages: files and routes that are not a $page, such as /llms.txt |
path |
string |
No | Route path the sitemap is served at. |
static |
boolean |
No | Prerender the sitemap to a static file at build time. |
#Examples
ts
1import { $sitemap } from "alepha/react/sitemap";2 3class AppRouter {4 sitemap = $sitemap();5}