import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' import Link from 'next/link' import { useRouter } from 'next/router' import CONFIG from '../config' import BlogItem from './BlogItem' /** * 使用分页插件的博客列表 * @param {*} props * @returns */ export const BlogListPage = props => { const { page = 1, posts, postCount } = props const { locale, NOTION_CONFIG } = useGlobal() const router = useRouter() const totalPage = Math.ceil( postCount / siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) ) const currentPage = +page const showPrev = currentPage > 1 const showNext = page < totalPage const pagePrefix = router.asPath .split('?')[0] .replace(/\/page\/[1-9]\d*/, '') .replace(/\/$/, '') const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG) return (