import { useRouter } from 'next/router' import Link from 'next/link' import { BlogItem } from './BlogItem' import { AdSlot } from '@/components/GoogleAdsense' import { siteConfig } from '@/lib/config' import CONFIG from '../config' /** * 博客列表 * @param {*} props * @returns */ export default function BlogListPage(props) { const { page = 1, posts, postCount } = props const router = useRouter() const totalPage = Math.ceil(postCount / parseInt(siteConfig('POSTS_PER_PAGE'))) const currentPage = +page // 博客列表嵌入广告 const SIMPLE_POST_AD_ENABLE = siteConfig('SIMPLE_POST_AD_ENABLE', false, CONFIG) const showPrev = currentPage > 1 const showNext = page < totalPage const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') return (