Skip to content

Commit

Permalink
fix: use page id overrides in links
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Feb 11, 2021
1 parent 396aee0 commit 509e263
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/map-page-url.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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 })

Expand Down

0 comments on commit 509e263

Please sign in to comment.