mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 23:16:49 +00:00
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
import { getAllCategories, getAllPosts, getAllTags } from '@/lib/notion'
|
|
import BLOG from '@/blog.config'
|
|
import BaseLayout from '@/layouts/BaseLayout'
|
|
import BlogPostListScroll from '@/components/BlogPostListScroll'
|
|
|
|
export async function getStaticProps () {
|
|
let posts = await getAllPosts({ from: 'index' })
|
|
posts = posts.filter(
|
|
post => post.status[0] === 'Published' && post.type[0] === 'Post'
|
|
)
|
|
const tags = await getAllTags(posts)
|
|
const categories = await getAllCategories(posts)
|
|
const meta = {
|
|
title: `${BLOG.title} | ${BLOG.description} `,
|
|
description: BLOG.description,
|
|
type: 'website'
|
|
}
|
|
return {
|
|
props: {
|
|
posts,
|
|
tags,
|
|
categories,
|
|
meta
|
|
},
|
|
revalidate: 1
|
|
}
|
|
}
|
|
|
|
const Index = ({ posts, tags, meta, categories }) => {
|
|
return (
|
|
<BaseLayout meta={meta} tags={tags} totalPosts={posts} categories={categories}>
|
|
<div className='flex-grow bg-gray-200 dark:bg-black shadow-inner'>
|
|
<BlogPostListScroll posts={posts} tags={tags} />
|
|
</div>
|
|
</BaseLayout>
|
|
)
|
|
}
|
|
|
|
export default Index
|