fix draft post display and improve typings

This commit is contained in:
Timothy Lin
2023-07-26 00:49:18 +08:00
parent f133d76695
commit 7b56a4836b
6 changed files with 31 additions and 27 deletions

View File

@@ -1,7 +1,6 @@
import ListLayout from '@/layouts/ListLayout'
import { sortedBlogPost } from 'pliny/utils/contentlayer'
import { allCoreContent, sortPosts } from 'pliny/utils/contentlayer'
import { allBlogs } from 'contentlayer/generated'
import type { Blog } from 'contentlayer/generated'
import { genPageMetadata } from 'app/seo'
const POSTS_PER_PAGE = 5
@@ -9,7 +8,7 @@ const POSTS_PER_PAGE = 5
export const metadata = genPageMetadata({ title: 'Blog' })
export default function BlogPage() {
const posts = sortedBlogPost(allBlogs) as Blog[]
const posts = allCoreContent(sortPosts(allBlogs))
const pageNumber = 1
const initialDisplayPosts = posts.slice(
POSTS_PER_PAGE * (pageNumber - 1),