Skip to content

Commit ef753e7

Browse files
committed
feat: catch all paths for pageUrlOverrides
1 parent 7193796 commit ef753e7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export interface Params extends ParsedUrlQuery {
2121
pageId: string
2222
}
2323

24+
export interface PageParams extends ParsedUrlQuery {
25+
pageId: string
26+
}
27+
2428
export interface Site {
2529
name: string
2630
domain: string

pages/[pageId].tsx renamed to pages/[...pageId].tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { NotionPage } from '@/components/NotionPage'
55
import { domain, isDev } from '@/lib/config'
66
import { getSiteMap } from '@/lib/get-site-map'
77
import { resolveNotionPage } from '@/lib/resolve-notion-page'
8-
import { PageProps, Params } from '@/lib/types'
8+
import {PageParams, PageProps, Params} from '@/lib/types'
99

10-
export const getStaticProps: GetStaticProps<PageProps, Params> = async (
10+
export const getStaticProps: GetStaticProps<PageProps, PageParams> = async (
1111
context
1212
) => {
13-
const rawPageId = context.params.pageId as string
13+
const rawPageId = (context.params.pageId).join('/')
1414

1515
try {
1616
const props = await resolveNotionPage(domain, rawPageId)
@@ -38,7 +38,7 @@ export async function getStaticPaths() {
3838
const staticPaths = {
3939
paths: Object.keys(siteMap.canonicalPageMap).map((pageId) => ({
4040
params: {
41-
pageId
41+
pageId: pageId.split('/')
4242
}
4343
})),
4444
// paths: [],

0 commit comments

Comments
 (0)