import { getAllCategories, getAllPosts, getAllTags } from '@/lib/notion' import BLOG from '@/blog.config' import BaseLayout from '@/layouts/BaseLayout' import TagItem from '@/components/TagItem' import { getNotionPageData } from '@/lib/notion/getNotionData' import { useGlobal } from '@/lib/global' export default function Tag ({ tags, allPosts, categories }) { const meta = { title: `${BLOG.title} | 标签`, description: BLOG.description, type: 'website' } const { locale } = useGlobal() return
{locale.COMMON.TAGS}:
{ tags.map(tag => { return
}) }
} export async function getStaticProps () { const from = 'tag-index-props' const notionPageData = await getNotionPageData({ from }) const allPosts = await getAllPosts({ notionPageData, from }) const categories = await getAllCategories(allPosts) const tagOptions = notionPageData.tagOptions const tags = await getAllTags({ allPosts, sliceCount: 0, tagOptions }) return { props: { tags, allPosts, categories }, revalidate: 1 } }