标题处理、标签页分页处理

This commit is contained in:
tangly1024
2021-10-16 15:26:09 +08:00
parent bca507029c
commit 3d70843441
12 changed files with 205 additions and 209 deletions

View File

@@ -1,5 +1,6 @@
import { getAllPosts, getAllTags } from '@/lib/notion'
import IndexLayout from '@/layouts/IndexLayout'
import BLOG from '@/blog.config'
export async function getStaticProps () {
let posts = await getAllPosts()
@@ -7,20 +8,25 @@ export async function getStaticProps () {
post => post.status[0] === 'Published' && post.type[0] === 'Post'
)
const tags = await getAllTags(posts)
const meta = {
title: `${BLOG.title} | 首页`,
description: BLOG.description,
type: 'website'
}
return {
props: {
page: 1, // current page is 1
posts,
tags
tags,
meta
},
revalidate: 1
}
}
const index = ({ posts, page, tags }) => {
const index = ({ posts, page, tags, meta }) => {
return (
<IndexLayout tags={tags} posts={posts} page={page} />
<IndexLayout tags={tags} posts={posts} page={page} meta={meta} />
)
}