From 23ac2195c90b73779b1cedc00c500e4396022a42 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 24 Nov 2023 14:50:34 +0800 Subject: [PATCH] =?UTF-8?q?simple-=E4=B8=BB=E9=A2=98=E5=B9=BF=E5=91=8A?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/simple/components/BlogListPage.js | 10 +++++++--- themes/simple/config.js | 2 ++ themes/simple/index.js | 4 +++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/themes/simple/components/BlogListPage.js b/themes/simple/components/BlogListPage.js index f09fb80194b..877d047366a 100644 --- a/themes/simple/components/BlogListPage.js +++ b/themes/simple/components/BlogListPage.js @@ -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 => {
{posts?.map((p, index) => (
- {(index + 1) % 3 === 0 && } - { (index + 1) === 4 && } - + {SIMPLE_POST_AD_ENABLE && (index + 1) % 3 === 0 && } + {SIMPLE_POST_AD_ENABLE && (index + 1) === 4 && } +
))}
diff --git a/themes/simple/config.js b/themes/simple/config.js index dcaf8c54bc7..18ebc783bd2 100644 --- a/themes/simple/config.js +++ b/themes/simple/config.js @@ -7,6 +7,8 @@ const CONFIG = { SIMPLE_AUTHOR_LINK: process.env.NEXT_PUBLIC_AUTHOR_LINK || '#', + SIMPLE_POST_AD_ENABLE: process.env.NEXT_PUBLIC_SIMPLE_POST_AD_ENABLE || false, // 文章列表是否插入广告 + // 菜单配置 SIMPLE_MENU_CATEGORY: true, // 显示分类 SIMPLE_MENU_TAG: true, // 显示标签 diff --git a/themes/simple/index.js b/themes/simple/index.js index aebb9d21ba5..7c567427b22 100644 --- a/themes/simple/index.js +++ b/themes/simple/index.js @@ -25,6 +25,7 @@ import { Transition } from '@headlessui/react' import { Style } from './style' import replaceSearchResult from '@/components/Mark' import CommonHead from '@/components/CommonHead' +import WWAds from '@/components/WWAds' /** * 基础布局 @@ -172,7 +173,8 @@ const LayoutSlug = props => { {/* 广告嵌入 */} - + {/* */} + {/* Notion文章主体 */} {!lock && }