@website SDK based on its current CMS schema. Page code uses that SDK to define routes, declare server-side CMS queries, and render typed results.
Page definition
A page directly default-exportsdefinePage({ ... }):
pages/post
The default export,
definePage call, top-level object, and route literal must be direct and inline. Top-level object spreads, computed properties, indirect exports, variables used as routes, and route template literals fail static extraction.
See Configure routes and redirects for the complete route grammar and matching behavior. See Configure SEO metadata for metadata fields and templates.
Generated CMS query builder
Thecms object has one property per collection slug in the website’s CMS schema. Each collection supports get and list:
__proto__, constructor, or prototype.
Get one item
Use exactly one ofslug or id:
If the parameter is absent or no published item matches, Cactal serves the site’s custom
not_found page with HTTP 404, exactly as it does for an unmatched route. Sites without a not_found file get the standard platform 404. Use a list query when an empty result is valid page content.
List items
list returns published items in manual CMS order by default:
pages/blog
List inputs
Do not use
cursor and page together. The list result includes both nextCursor and nextPage; use the value matching your pagination style.
Filters
A filter can address at most 20 fields and contain at most 50 field/operator clauses. Unlike the REST item-list endpoint, the page query builder filters schema fields only, not item metadata such as
createdAt, publishedAt, or publishAt.
Use slug to filter a reference from a dynamic route without first looking up
the referenced item id:
limit, cursor, or page, so pagination describes the filtered set.
Search and sort
Search accepts a string or request parameter:Bind request parameters
Thequeries function receives a placeholder builder named param:
param.path(name)is type-checked against:namesegments in the page route.param.query(name)reads one query-string key.- Values are coerced for their destination. Numeric pagination and number filters require numbers; boolean filters accept
trueorfalse. - Repeated query-string values are accepted only where an
inorninfilter expects multiple values.
Path and query parameters are source-specific. A missing path parameter never falls back to a query parameter with the same name.
Render results
Therender function receives:
Item result
get returns:
fields type is generated from the collection. Optional values include null; gallery and multi-value fields use arrays. Image and file fields include their ready CDN URL and asset metadata.
At depth: 0, references are item ids. At greater depths, references become nested items with the same { id, slug, fields, meta } shape. The page query maximum is 2, even though direct CMS API reads support depth 3.
List result
list returns:
Published content and schema changes
Published sites and draft previews both query published CMS items. Draft, scheduled, unpublished, and deleted items do not appear in page results. A scheduled item begins appearing after Cactal promotes it and recordspublishedAt.
The published website guards its schema. A collection or field change that would break published page queries is rejected. Update page source, publish the compatible code, then change the schema. Collection-slug and field-key renames use dedicated CMS operations that migrate references safely.
Sitemap discovery
A dynamic route can be enumerated in the generated sitemap when it has exactly one route parameter and exactly oneget query whose slug or id is bound to that parameter:
Troubleshooting
Next steps
- Manage CMS content to create collections, fields, and published items
- Configure routes and redirects for route matching and canonical paths
- Configure SEO metadata to resolve query data into titles and social tags
- Style a website with global CSS and Tailwind CSS