Kind: Function
Source: src/helper/ssg/middleware.ts
Part of: Helper
Define SSG Route
ssgParams defines route parameters for static site generation. It connects route-specific parameter data to the SSG middleware so matching pages can be generated during the build process.
Signature
tsfunction ssgParams(params)
Parameters
| Name | Type |
|---|---|
params | any |
Diagram
mermaidgraph LR Route[Route definition] --> Params[SSG parameters] Params --> ssgParams[ssgParams] ssgParams --> Middleware[SSG middleware] Middleware --> StaticPage[Generated static page]
Usage
tsimport { ssgParams } from './helper/ssg/middleware'
const params = ssgParams({
slug: 'getting-started',
})
export default params
AI Coding Instructions
- Keep SSG parameter values aligned with the dynamic segments declared by the route.
- Pass serializable values that can be resolved during static generation.
- Add route parameter handling through
ssgParamsinstead of duplicating SSG middleware behavior. - Verify that generated parameter values match the paths expected by the router.
Was this page helpful?