Skip to main content
Every page in OlonJS starts as a JSON file in src/data/pages/. You compose the page by listing sections with their data and settings, and OlonJS turns that JSON into a fully rendered Next.js route. This guide covers both static pages and dynamic collection routes.

Creating a static page


Creating a dynamic (collection) page

Dynamic pages generate one URL per item in a collection. You create them by naming the file with a [slug] segment and adding a collection field to the JSON. Create a directory under src/data/pages/ whose name matches the collection route prefix, then add a [slug].json template file inside it:
src/data/pages/products/[slug].json
The special $ref value "collection:current" tells OlonJS to inject the collection item matching the current URL slug. At build time the framework generates individual baked pages for every item in the referenced collection, so each product gets its own pre-rendered route at /products/<id>.
The collection.paramKey must match the bracket name in the filename. If the file is [slug].json, use "paramKey": "slug". If the file is [id].json, use "paramKey": "id".
Here is the real dynamic page template for Inkwell posts as a reference:
src/data/pages/posts/[slug].json

Page sections quick reference

OlonJS ships 13 built-in section types. Use the type field in each section entry to select one.

SEO metadata

Set meta.title and meta.description on every page file. OlonJS uses these values to populate the Next.js <head> and expose them in the MCP manifest for AI-agent discovery.
Write meta.description as a standalone sentence that makes sense out of context — it appears in Google snippets, link previews, and the AI-agent site manifest.
Dynamic collection pages share one meta block in the template. If you need per-item metadata (e.g. the post title as the page title), set the value to "collection:current" and OlonJS will resolve it from the current item at render time. Check the section schema for the specific field names your section type supports.