ReferenceSchema API
s.router()
A record whose keys are the routes of your site: one entry, one page.
Use it for
- Blog posts, products and case studies, each at its own URL
- Letting editors add a page without a developer
Router Schema
s.router(router, schema)
schemaA shorthand for creating router configurations. This combines s.record(schema).router(router) into a single call.
Use this to define page routes in your application, where each key in the record represents a URL path.
In Val Studio
Options
routerRouter
The router configuration (e.g., nextAppRouter for Next.js App Router).
nextAppRouterschemaSchema
The schema for each route's content.
s.object({ title: s.string() })Methods
.validate
Custom validation function
Examples
Basic Usage
TypeScript
Equivalent to
TypeScript
See alsopage-router