Skip to content

Commit

Permalink
fix: build notion page
Browse files Browse the repository at this point in the history
  • Loading branch information
SiongSng committed Jul 28, 2023
1 parent 700301f commit bbf94d9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions components/NotionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,20 @@ export const NotionPage: React.FC<types.PageProps> = ({

const keys = Object.keys(recordMap?.block || {})
const block = recordMap?.block?.[keys[0]]?.value
const title = block
? getBlockTitle(block, recordMap) ?? site.name
: 'Notion Page'

const title = getBlockTitle(block, recordMap) || site.name
// const isRootPage =
// parsePageId(block?.id) === parsePageId(site?.rootNotionPageId)
const isBlogPost =
block?.type === 'page' && block?.parent_table === 'collection'

const showTableOfContents = !!isBlogPost
const minTableOfContentsItems = 3

React.useEffect(() => {
if (router.isReady) {
if (router.isReady && isBlogPost) {
setDisqusConfig({
// url: `test-page.notion.dev.daoedu.tw${router.asPath}`,
url: `${process.env.HOSTNAME}${router.asPath}`,
Expand All @@ -210,15 +219,7 @@ export const NotionPage: React.FC<types.PageProps> = ({
language: 'zh_TW' // e.g. for Traditional Chinese (Taiwan)
})
}
}, [router.asPath, router.isReady, title])

// const isRootPage =
// parsePageId(block?.id) === parsePageId(site?.rootNotionPageId)
const isBlogPost =
block?.type === 'page' && block?.parent_table === 'collection'

const showTableOfContents = !!isBlogPost
const minTableOfContentsItems = 3
}, [isBlogPost, router.asPath, router.isReady, title])

const pageAside = React.useMemo(
() => (
Expand Down

0 comments on commit bbf94d9

Please sign in to comment.