Skip to content

Commit 928dc30

Browse files
committed
static params for the components
1 parent 26b523c commit 928dc30

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

apps/docs/src/app/r/[[...name]]/route.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { handle } from "hono/vercel";
22
import app from "./registry";
3+
import { getRegistryIndex } from "@proofkit/registry";
34

45
const handler = handle(app);
56
export {
@@ -11,3 +12,29 @@ export {
1112
handler as OPTIONS,
1213
handler as HEAD,
1314
};
15+
16+
// Generate static params for all registry routes
17+
export async function generateStaticParams() {
18+
try {
19+
const index = await getRegistryIndex();
20+
21+
const params = [
22+
// Root registry route
23+
{ name: [] },
24+
// Individual component routes
25+
...index.map((item) => ({
26+
name: item.name.split('/'),
27+
})),
28+
// Meta routes for each component
29+
...index.map((item) => ({
30+
name: ['meta', ...item.name.split('/')],
31+
})),
32+
];
33+
34+
console.log('Generated static params for registry:', params);
35+
return params;
36+
} catch (error) {
37+
console.error('Failed to generate static params for registry:', error);
38+
return [{ name: [] }];
39+
}
40+
}

0 commit comments

Comments
 (0)