mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-15 07:26:48 +00:00
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
|
|
import React from 'react'
|
|
import { useGlobal } from '@/lib/global'
|
|
import * as ThemeMap from '@/themes'
|
|
import { getAllTags } from '@/lib/notion'
|
|
import BLOG from '@/blog.config'
|
|
|
|
/**
|
|
* 标签首页
|
|
* @param {*} props
|
|
* @returns
|
|
*/
|
|
const TagIndex = props => {
|
|
const { theme } = useGlobal()
|
|
const ThemeComponents = ThemeMap[theme]
|
|
const { locale } = useGlobal()
|
|
const { siteInfo } = props
|
|
const meta = {
|
|
title: `${locale.COMMON.TAGS} | ${siteInfo?.title}`,
|
|
description: siteInfo?.description,
|
|
image: siteInfo?.pageCover,
|
|
slug: 'tag',
|
|
type: 'website'
|
|
}
|
|
return <ThemeComponents.LayoutTagIndex {...props} meta={meta} />
|
|
}
|
|
|
|
export async function getStaticProps() {
|
|
const from = 'tag-index-props'
|
|
const props = await getGlobalNotionData({ from })
|
|
props.tags = getAllTags({ allPages: props.allPages, sliceCount: 0, tagOptions: props.tagOptions })
|
|
delete props.tagOptions
|
|
return {
|
|
props,
|
|
revalidate: BLOG.NEXT_REVALIDATE_SECOND
|
|
}
|
|
}
|
|
|
|
export default TagIndex
|