filter non-public page on sitemap

This commit is contained in:
WonJung Kim
2023-03-07 12:25:04 +09:00
parent 7923b55264
commit 29014998ea

View File

@@ -1,4 +1,4 @@
import { getAllPagesInSpace, uuidToId } from 'notion-utils'
import { getAllPagesInSpace, uuidToId, getPageProperty } from 'notion-utils'
import pMemoize from 'p-memoize'
import * as config from './config'
@@ -47,6 +47,11 @@ async function getAllPagesImpl(
throw new Error(`Error loading page "${pageId}"`)
}
const block = recordMap.block[pageId]?.value
if (!(getPageProperty<boolean|null>('Public', block, recordMap) ?? true)) {
return map
}
const canonicalPageId = getCanonicalPageId(pageId, recordMap, {
uuid
})