import BLOG from '@/blog.config' import { useRouter } from 'next/router' import Link from 'next/link' import { BlogItem } from './BlogItem' import { AdSlot } from '@/components/GoogleAdsense' export const BlogListPage = props => { const { page = 1, posts, postCount } = props const router = useRouter() const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) const currentPage = +page const showPrev = currentPage > 1 const showNext = page < totalPage const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') return (
{posts?.map((p, index) => (
{(index + 1) % 3 === 0 && } { (index + 1) === 4 && }
))}
NEWER POSTS OLDER POSTS
) }