mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-08 15:10:37 +00:00
simple-主题广告位
This commit is contained in:
@@ -4,6 +4,7 @@ import Link from 'next/link'
|
||||
import { BlogItem } from './BlogItem'
|
||||
import { AdSlot } from '@/components/GoogleAdsense'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import CONFIG from '../config'
|
||||
|
||||
export const BlogListPage = props => {
|
||||
const { page = 1, posts, postCount } = props
|
||||
@@ -11,6 +12,9 @@ export const BlogListPage = props => {
|
||||
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(/\/$/, '')
|
||||
@@ -20,9 +24,9 @@ export const BlogListPage = props => {
|
||||
|
||||
<div id="posts-wrapper">
|
||||
{posts?.map((p, index) => (<div key={p.id}>
|
||||
{(index + 1) % 3 === 0 && <AdSlot type='in-article' />}
|
||||
{ (index + 1) === 4 && <AdSlot type='flow'/>}
|
||||
<BlogItem post={p} />
|
||||
{SIMPLE_POST_AD_ENABLE && (index + 1) % 3 === 0 && <AdSlot type='in-article' />}
|
||||
{SIMPLE_POST_AD_ENABLE && (index + 1) === 4 && <AdSlot type='flow' />}
|
||||
<BlogItem post={p} />
|
||||
</div>))}
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user