Skip to content

Commit

Permalink
fix(docs): ssg
Browse files Browse the repository at this point in the history
  • Loading branch information
JMBeresford committed May 9, 2024
1 parent bbaa124 commit 1ad439f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/web/app/docs/[type]/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const views: Record<string, View | undefined> = {
};

export default function Page(props: { params: ViewParams }): JSX.Element {
const { type } = props.params;
const type = normalizeTypeName(props.params.type);
const View = views[type];

if (!View) {
Expand All @@ -37,6 +37,12 @@ export default function Page(props: { params: ViewParams }): JSX.Element {

export function generateStaticParams(): ViewParams[] {
return Array.from(allGroups)
.map(([type, ids]) => ids.map((id) => ({ type, id })))
.map(([type, ids]) =>
ids.map((id) => ({ type: normalizeTypeName(type), id })),
)
.flat();
}

function normalizeTypeName(type: string): string {
return type.toLowerCase().replaceAll(" ", "");
}

0 comments on commit 1ad439f

Please sign in to comment.