mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 23:16:49 +00:00
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/notion'
|
|
import BLOG from '@/blog.config'
|
|
import BaseLayout from '@/layouts/BaseLayout'
|
|
import BlogPostListScroll from '@/components/BlogPostListScroll'
|
|
import { getNotionPageData } from '@/lib/notion/getNotionData'
|
|
|
|
export async function getStaticProps () {
|
|
const from = 'index'
|
|
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, tagOptions })
|
|
const meta = {
|
|
title: `${BLOG.title} | ${BLOG.description} `,
|
|
description: BLOG.description,
|
|
type: 'website'
|
|
}
|
|
return {
|
|
props: {
|
|
allPosts,
|
|
tags,
|
|
categories,
|
|
meta
|
|
},
|
|
revalidate: 1
|
|
}
|
|
}
|
|
|
|
const Index = ({ allPosts, tags, meta, categories }) => {
|
|
return (
|
|
<BaseLayout meta={meta} tags={tags} totalPosts={allPosts} categories={categories}>
|
|
<div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'>
|
|
<BlogPostListScroll posts={allPosts} tags={tags} />
|
|
</div>
|
|
</BaseLayout>
|
|
)
|
|
}
|
|
|
|
export default Index
|