Routes
The rest of the routes
| Create | Export | From |
|---|---|---|
app/page.tsx |
default, generateMetadata |
createHome(config, blocks), createHomeMetadata(config) |
app/blog/[slug]/page.tsx |
default, generateMetadata |
createBlogPost(config), createPostMetadata(config) |
app/authors/[slug]/page.tsx |
default |
createCollectionDetail(config, "author", { related: { collection: "post", via: "Author" } }) |
app/categories/[slug]/page.tsx |
default |
createCollectionDetail(config, "category", { related: { collection: "post", via: "Category" } }) |
app/feed.xml/route.ts |
GET |
createFeed(config) |
app/sitemap.ts |
default |
createSitemap(config) |
app/robots.ts |
default |
createRobots(config) |
app/api/revalidate/route.ts |
POST, GET |
createRevalidateRoute(config) |
app/[...path]/page.tsx |
default, generateMetadata |
createPage(config, blocks), createPageMetadata(config) |
app/doctors/page.tsx |
default |
createCollectionIndex(config, "doctors") |
app/doctors/[slug]/page.tsx |
default, generateMetadata, generateStaticParams |
createCollectionDetail(config, "doctors"), createCollectionMetadata(config, "doctors"), createCollectionStaticParams(config, "doctors") |
app/api/blocks/route.ts |
GET, OPTIONS |
createBlockSchemaRoute(config, blocks), createBlockSchemaPreflight() |
app/api/blocks/bindings/route.ts |
GET, OPTIONS |
createBindingReportRoute(config, blocks), createBindingReportPreflight() |
app/layout.tsx |
default, generateMetadata |
createSiteLayout(config, { blocks }), createSiteMetadata(config) |
app/%5Fshare/route.ts |
GET |
createSharePage(config) |
app/api/share/redeem/route.ts |
POST |
createShareRedeemRoute(config) |
createHome serves whatever the tenant picked for /: the page at HomePath, the index of
HomeCollection, or the post index when it picked neither, which is what createBlogIndex did and
still does for a site that mounts that instead.
via is the post's field that references the author or category. createArchive(config, "author")
makes that same call and is @deprecated since 0.7.0, as is createArchiveStaticParams, which is
createCollectionStaticParams.
Mount only what you want. Nothing requires anything else. The paths only have to agree with the
routes in your config, which is what every generated link is built from.
createBlogPostPreview replaces createBlogPost when you want ?preview=TOKEN to render a draft.
It reads searchParams, which forces the route dynamic, so a site using output: "export" takes
createBlogPost and gives up preview. createPostStaticParams and createCollectionStaticParams
exist for that static case.
A site that draws its own post page keeps preview by giving the detail route its own view, and maps the item with the engine's own mapping:
export default createCollectionDetail(config, POST_COLLECTION, {
preview: true,
view: ({ config, item, preview }) => <MyPost post={postFromItem(config, item)} preview={preview} />,
});
The binding report says why a binding on a page did not resolve, so an editor fixes it in barakoBrew
instead of asking whoever can read the server log. Ask for one page at a time, by ?slug= or
?path=, and each problem names the binding as typed, the reason (unknown scope, unbound scope
or no value), and the block and field it came from. It reports the page as rendered, not as
stored, so a {{item.X}} outside a repeat is reported as an unbound scope. Give it the query
option the page's route works out to. createPage and createHome default it by where they are
mounted: off under a request-time site's app/%5Fpress/[site], where a {{query.X}} is an unbound
scope for every visitor, and on for a route outside it, such as a build-time site's
app/[...path]. The report defaults to off wherever it is mounted, so for a page on a route outside
the tenant segment pass { query: true }, or the report calls a {{query.X}} that works on the page
an unbound scope. It is never anonymous:
the caller presents the tenant's key as Authorization: Bearer, derived from PRESS_SECRET and
printed by barakopress bindings-key <tenant>. Answers are never cached.
Card and PostView are exported too, for a site that wants its own page but the engine's markup. SiteAnalytics is exported too, for a site that draws its own root layout: it goes in that layout's <head>.