Skip to content

Commit

Permalink
fix(routes): don't generate static [uid] pages for home and contact
Browse files Browse the repository at this point in the history
  • Loading branch information
charles4221 committed Jan 31, 2024
1 parent 660c411 commit 594f330
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/[uid]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ export default async function Page({ params }: Props) {
return <SliceZone slices={page.data.slices} components={components} />;
}

const pagesHandledInOtherRoutes = new Set(['home', 'contact']);

export async function generateStaticParams() {
const client = createClient();

const pages = await client.getAllByType('page');

return pages.map((page) => {
return { uid: page.uid };
});
return pages
.filter((page) => !pagesHandledInOtherRoutes.has(page.uid))
.map((page) => {
return { uid: page.uid };
});
}

0 comments on commit 594f330

Please sign in to comment.