mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-31 07:26:46 +00:00
fix: use page id overrides in links
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
import * as types from './types'
|
||||
import { ExtendedRecordMap } from 'notion-types'
|
||||
import { uuidToId, parsePageId } from 'notion-utils'
|
||||
|
||||
import { Site } from './types'
|
||||
import { includeNotionIdInUrls } from './config'
|
||||
import { getCanonicalPageId, uuidToId, parsePageId } from 'notion-utils'
|
||||
import { getCanonicalPageId } from './get-canonical-page-id'
|
||||
|
||||
// include UUIDs in page URLs during local development but not in production
|
||||
// (they're nice for debugging and speed up local dev)
|
||||
const uuid = !!includeNotionIdInUrls
|
||||
|
||||
export const mapPageUrl = (
|
||||
site: types.Site,
|
||||
recordMap: types.ExtendedRecordMap,
|
||||
site: Site,
|
||||
recordMap: ExtendedRecordMap,
|
||||
searchParams: URLSearchParams
|
||||
) => (pageId = '') => {
|
||||
if (uuidToId(pageId) === site.rootNotionPageId) {
|
||||
@@ -22,8 +25,8 @@ export const mapPageUrl = (
|
||||
}
|
||||
|
||||
export const getCanonicalPageUrl = (
|
||||
site: types.Site,
|
||||
recordMap: types.ExtendedRecordMap
|
||||
site: Site,
|
||||
recordMap: ExtendedRecordMap
|
||||
) => (pageId = '') => {
|
||||
const pageUuid = parsePageId(pageId, { uuid: true })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user