Merge branch 'main' into feat/new-theme-landing

This commit is contained in:
tangly1024.com
2023-07-05 12:30:45 +08:00
37 changed files with 338 additions and 100 deletions

View File

@@ -1,6 +1,6 @@
import BLOG from '@/blog.config'
import { getPostBlocks } from '@/lib/notion'
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
import { getGlobalData } from '@/lib/notion/getNotionData'
import { useEffect, useState } from 'react'
import { idToUuid } from 'notion-utils'
import { useRouter } from 'next/router'
@@ -61,9 +61,6 @@ const Slug = props => {
post.toc = getPageTableOfContents(post, post.blockMap)
}
}
router.events.on('routeChangeComplete', () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
})
}, [post])
const meta = {
@@ -90,7 +87,7 @@ export async function getStaticPaths() {
}
const from = 'slug-paths'
const { allPages } = await getGlobalNotionData({ from })
const { allPages } = await getGlobalData({ from })
return {
paths: allPages?.map(row => ({ params: { slug: [row.slug] } })),
fallback: true
@@ -105,7 +102,7 @@ export async function getStaticProps({ params: { slug } }) {
}
}
const from = `slug-props-${fullSlug}`
const props = await getGlobalNotionData({ from })
const props = await getGlobalData({ from })
// 在列表内查找文章
props.post = props?.allPages?.find((p) => {
return p.slug === fullSlug || p.id === idToUuid(fullSlug)