Skip to content

Commit 7b1fc5f

Browse files
📗
1 parent 4641fd6 commit 7b1fc5f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

components/NotionPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export const NotionPage: React.FC<types.PageProps> = ({
195195
// parsePageId(block?.id) === parsePageId(site?.rootNotionPageId)
196196
const isBlogPost =
197197
block?.type === 'page' && block?.parent_table === 'collection'
198+
198199
const showTableOfContents = !!isBlogPost
199200
const minTableOfContentsItems = 3
200201

pages/feed.xml.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import RSS from 'rss'
22
import type { GetServerSideProps } from 'next'
3-
import { getBlockTitle, getPageProperty } from 'notion-utils'
3+
import {
4+
getBlockParentPage,
5+
getBlockTitle,
6+
getPageProperty,
7+
idToUuid
8+
} from 'notion-utils'
9+
import { ExtendedRecordMap } from 'notion-types'
410

511
import * as config from 'lib/config'
612
import { getSiteMap } from 'lib/get-site-map'
@@ -30,13 +36,22 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
3036

3137
for (const pagePath of Object.keys(siteMap.canonicalPageMap)) {
3238
const pageId = siteMap.canonicalPageMap[pagePath]
33-
const recordMap = siteMap.pageMap[pageId]
39+
const recordMap = siteMap.pageMap[pageId] as ExtendedRecordMap
3440
if (!recordMap) continue
3541

3642
const keys = Object.keys(recordMap?.block || {})
3743
const block = recordMap?.block?.[keys[0]]?.value
3844
if (!block) continue
3945

46+
const parentPage = getBlockParentPage(block, recordMap)
47+
const isBlogPost =
48+
block.type === 'page' &&
49+
block.parent_table === 'collection' &&
50+
parentPage?.id === idToUuid(config.rootNotionPageId)
51+
if (!isBlogPost) {
52+
continue
53+
}
54+
4055
const title = getBlockTitle(block, recordMap) || config.name
4156
const description =
4257
getPageProperty<string>('Description', block, recordMap) ||

0 commit comments

Comments
 (0)