Table of Contents
Page Router
What is the Page Router?
Val's page router allows you to create dynamic routes based on your content. By using `s.record().router(nextAppRouter)`, you can automatically generate pages for each entry in your content record.
Basic Setup
The documentation you're reading right now is built using Val's page router. Here's how it's structured:
How It Works
The router maps keys in your record to URL paths. Each key becomes a route, and Next.js will generate the corresponding pages automatically.
Links
Typically you also want to define links to pages in your application. You can do this using `s.keyOf`. Read more about it here.
Recursive keyOf with Router
When using keyOf with a router, it becomes recursive. This means if you add new pages to your router, they automatically become available as valid references in your keyOf fields. Your IDE will provide autocomplete for all available routes, and TypeScript will ensure all links are valid.
Note
More detailed examples and patterns will be added to this section in the future.