Files
NotionNext/pages/category/index.js
2024-11-18 18:10:18 +08:00

32 lines
852 B
JavaScript

import BLOG from '@/blog.config'
import { siteConfig } from '@/lib/config'
import { getGlobalData } from '@/lib/db/getSiteData'
import { DynamicLayout } from '@/themes/theme'
import { useRouter } from 'next/router'
/**
* 分类首页
* @param {*} props
* @returns
*/
export default function Category(props) {
const router = useRouter()
const theme = siteConfig('THEME', BLOG.THEME, props.NOTION_CONFIG)
return <DynamicLayout theme={theme} router={router} {...props} />
}
export async function getStaticProps({ locale }) {
const props = await getGlobalData({ from: 'category-index-props', locale })
delete props.allPages
return {
props,
revalidate: process.env.EXPORT
? undefined
: siteConfig(
'NEXT_REVALIDATE_SECOND',
BLOG.NEXT_REVALIDATE_SECOND,
props.NOTION_CONFIG
)
}
}