minor kittens

This commit is contained in:
Travis Fischer
2021-01-19 17:51:00 -05:00
parent 768e458b94
commit db02118b2d
4 changed files with 1443 additions and 68 deletions

View File

@@ -1,4 +1,5 @@
import * as types from 'lib/types'
import { getTextContent } from 'notion-utils'
export function getPageDescription(
block: types.Block,
@@ -12,7 +13,7 @@ export function getPageDescription(
)
if (descriptionKey) {
return block.properties[descriptionKey]
return getTextContent(block.properties[descriptionKey])
}
}

View File

@@ -1,6 +1,11 @@
import * as types from './types'
import { isDev } from './config'
import { getCanonicalPageId, uuidToId, parsePageId } from 'notion-utils'
// include UUIDs in page URLs during local development but not in production
// (they're nice for debugging and speed up local dev)
const uuid = !!isDev
export const mapPageUrl = (
site: types.Site,
recordMap: types.ExtendedRecordMap,
@@ -10,7 +15,7 @@ export const mapPageUrl = (
return createUrl('/', searchParams)
} else {
return createUrl(
`/${getCanonicalPageId(pageId, recordMap, { uuid: false })}`,
`/${getCanonicalPageId(pageId, recordMap, { uuid })}`,
searchParams
)
}
@@ -26,7 +31,7 @@ export const getCanonicalPageUrl = (
return `https://${site.domain}`
} else {
return `https://${site.domain}/${getCanonicalPageId(pageUuid, recordMap, {
uuid: false
uuid
})}`
}
}