Skip to content

Commit

Permalink
Fix: support for database external pages
Browse files Browse the repository at this point in the history
  • Loading branch information
izuolan committed Jan 31, 2023
1 parent c4dc494 commit 82feafe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pages/s/[subpage].js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,20 @@ export async function getStaticProps({ params: { subpage } }) {

const breadcrumbs = getPageBreadcrumbs(blockMap, id)
post = posts.find((t) => t.id === breadcrumbs[0].block.id)
// console.log(breadcrumbs, post)
// When the page is not in the notion database, manually initialize the post
if (!post) {
post = {
type: ['Page'],
title: breadcrumbs[0].title
}
}
// console.log("debug: ", breadcrumbs, post)
} catch (err) {
console.error(err)
return { props: { post: null, blockMap: null } }
}

// Allow only pages in your own space
const NOTION_SPACES_ID = BLOG.notionSpacesId
const pageAllowed = (page) => {
// When page block space_id = NOTION_SPACES_ID
Expand Down

0 comments on commit 82feafe

Please sign in to comment.