fix: use page id overrides in links

This commit is contained in:
Travis Fischer
2021-02-10 21:37:50 -05:00
parent 396aee01f5
commit 509e2631b8

View File

@@ -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 })