From 3f686ed16fd6ddd3da056c3caad9b18b871470f2 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 28 Jun 2024 16:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=88=86=E9=A1=B5=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/category/[category]/page/[page].js | 2 +- pages/page/[page].js | 2 +- pages/sitemap.xml.js | 1 - pages/tag/[tag]/page/[page].js | 2 +- .../commerce/components/BlogPostListPage.js | 2 +- .../commerce/components/BlogPostListScroll.js | 2 +- themes/example/components/BlogListPage.js | 2 +- themes/example/components/BlogListScroll.js | 2 +- themes/example/components/SearchInput.js | 1 - themes/fukasawa/components/BlogCard.js | 7 +- themes/fukasawa/components/BlogListPage.js | 35 +++-- themes/fukasawa/components/BlogListScroll.js | 130 ++++++++++-------- themes/fukasawa/index.js | 3 +- themes/fukasawa/style.js | 9 ++ themes/game/components/BlogListScroll.js | 2 +- themes/heo/components/BlogPostListPage.js | 2 +- themes/heo/components/BlogPostListScroll.js | 2 +- themes/hexo/components/BlogPostListPage.js | 2 +- themes/hexo/components/BlogPostListScroll.js | 2 +- themes/matery/components/BlogPostListPage.js | 2 +- .../matery/components/BlogPostListScroll.js | 2 +- themes/medium/components/BlogPostListPage.js | 2 +- .../medium/components/BlogPostListScroll.js | 2 +- themes/movie/components/BlogListPage.js | 2 +- themes/nav/components/BlogPostListPage.js | 2 +- themes/nav/components/NavPostItem.js | 2 - themes/next/components/BlogPostListPage.js | 2 +- themes/next/components/BlogPostListScroll.js | 2 +- themes/nobelium/components/BlogListPage.js | 2 +- themes/plog/components/BlogListPage.js | 2 +- themes/simple/components/BlogListPage.js | 2 +- themes/simple/components/BlogListScroll.js | 2 +- 32 files changed, 131 insertions(+), 105 deletions(-) diff --git a/pages/category/[category]/page/[page].js b/pages/category/[category]/page/[page].js index f9c6e909..120d762a 100644 --- a/pages/category/[category]/page/[page].js +++ b/pages/category/[category]/page/[page].js @@ -71,7 +71,7 @@ export async function getStaticPaths() { // 处理文章页数 const postCount = categoryPosts.length const totalPages = Math.ceil( - postCount / siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + postCount / siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) ) if (totalPages > 1) { for (let i = 1; i <= totalPages; i++) { diff --git a/pages/page/[page].js b/pages/page/[page].js index 5040bed0..bd1dc7e2 100644 --- a/pages/page/[page].js +++ b/pages/page/[page].js @@ -23,7 +23,7 @@ export async function getStaticPaths({ locale }) { const from = 'page-paths' const { postCount, NOTION_CONFIG } = await getGlobalData({ from, locale }) const totalPages = Math.ceil( - postCount / siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + postCount / siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) ) return { // remove first page, we 're not gonna handle that. diff --git a/pages/sitemap.xml.js b/pages/sitemap.xml.js index b5325513..2f6c20fe 100644 --- a/pages/sitemap.xml.js +++ b/pages/sitemap.xml.js @@ -27,7 +27,6 @@ export const getServerSideProps = async ctx => { 'Cache-Control', 'public, max-age=3600, stale-while-revalidate=59' ) - console.log('fff', fields) return getServerSideSitemap(ctx, fields) } diff --git a/pages/tag/[tag]/page/[page].js b/pages/tag/[tag]/page/[page].js index 49a184d0..da93f16f 100644 --- a/pages/tag/[tag]/page/[page].js +++ b/pages/tag/[tag]/page/[page].js @@ -56,7 +56,7 @@ export async function getStaticPaths() { // 处理文章页数 const postCount = tagPosts.length const totalPages = Math.ceil( - postCount / siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + postCount / siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) ) if (totalPages > 1) { for (let i = 1; i <= totalPages; i++) { diff --git a/themes/commerce/components/BlogPostListPage.js b/themes/commerce/components/BlogPostListPage.js index d762e083..4c3ba5ac 100644 --- a/themes/commerce/components/BlogPostListPage.js +++ b/themes/commerce/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import ProductCard from './ProductCard' */ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE if (!posts || posts.length === 0 || page > totalPage) { diff --git a/themes/commerce/components/BlogPostListScroll.js b/themes/commerce/components/BlogPostListScroll.js index 004e2b5e..a00b8cc3 100644 --- a/themes/commerce/components/BlogPostListScroll.js +++ b/themes/commerce/components/BlogPostListScroll.js @@ -20,7 +20,7 @@ const BlogPostListScroll = ({ siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const [page, updatePage] = useState(1) const postsToShow = getListByPage(posts, page, POSTS_PER_PAGE) diff --git a/themes/example/components/BlogListPage.js b/themes/example/components/BlogListPage.js index 79934d77..fe56e0bf 100644 --- a/themes/example/components/BlogListPage.js +++ b/themes/example/components/BlogListPage.js @@ -14,7 +14,7 @@ export const BlogListPage = props => { const { locale, NOTION_CONFIG } = useGlobal() const router = useRouter() const totalPage = Math.ceil( - postCount / siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + postCount / siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) ) const currentPage = +page diff --git a/themes/example/components/BlogListScroll.js b/themes/example/components/BlogListScroll.js index 3ddc340a..d712b919 100644 --- a/themes/example/components/BlogListScroll.js +++ b/themes/example/components/BlogListScroll.js @@ -13,7 +13,7 @@ export const BlogListScroll = props => { const { posts } = props const { locale, NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) let hasMore = false const postsToShow = posts diff --git a/themes/example/components/SearchInput.js b/themes/example/components/SearchInput.js index 419e9984..043f2961 100644 --- a/themes/example/components/SearchInput.js +++ b/themes/example/components/SearchInput.js @@ -24,7 +24,6 @@ const SearchInput = ({ currentTag, keyword, cRef }) => { const key = searchInputRef.current.value if (key && key !== '') { router.push({ pathname: '/search/' + key }).then(r => { - console.log('搜索', key) }) } else { router.push({ pathname: '/' }).then(r => { diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 7419dede..2cfb0ce4 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -1,6 +1,7 @@ import LazyImage from '@/components/LazyImage' import NotionIcon from '@/components/NotionIcon' import { siteConfig } from '@/lib/config' +import { useGlobal } from '@/lib/global' import Link from 'next/link' import CONFIG from '../config' import TagItemMini from './TagItemMini' @@ -10,7 +11,8 @@ import TagItemMini from './TagItemMini' * @param {*} param0 * @returns */ -const BlogCard = ({ index, post, showSummary, siteInfo }) => { +const BlogCard = ({ showAnimate, post, showSummary }) => { +const {siteInfo} =useGlobal() const showPreview = siteConfig('FUKASAWA_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap // fukasawa 强制显示图片 @@ -24,11 +26,12 @@ const BlogCard = ({ index, post, showSummary, siteInfo }) => { const showPageCover = siteConfig('FUKASAWA_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail + const FUKASAWA_POST_LIST_ANIMATION = siteConfig( 'FUKASAWA_POST_LIST_ANIMATION', null, CONFIG - ) + ) || showAnimate // 动画样式 首屏卡片不用,后面翻出来的加动画 const aosProps = FUKASAWA_POST_LIST_ANIMATION diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js index e15c58fa..6d5e55b7 100644 --- a/themes/fukasawa/components/BlogListPage.js +++ b/themes/fukasawa/components/BlogListPage.js @@ -17,8 +17,9 @@ import PaginationSimple from './PaginationSimple' */ const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() + const postsPerPage = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil( - postCount / parseInt(siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG)) + postCount / postsPerPage ) const showNext = page < totalPage @@ -33,23 +34,27 @@ const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { return () => window.removeEventListener('resize', handleResize) }, []) - /** - * 文章重新布局,使纵向排列看起来是横向排列 - */ + /** + * 文章重新布局,使纵向排列看起来是横向排列 + */ useEffect(() => { - const count = posts?.length || 0 - const rows = Math.ceil(count / columns) - const newFilterPosts = [] - for (let i = 0; i < columns; i++) { - for (let j = 0; j < rows; j++) { - const index = j * columns + i - if (index < count) { - newFilterPosts.push(deepClone(posts[index])) + const count = posts?.length || 0; + const rows = Math.ceil(count / columns); + const newFilterPosts = new Array(count); + + let index = 0; + for (let col = 0; col < columns; col++) { + for (let row = 0; row < rows; row++) { + const sourceIndex = row * columns + col; + if (sourceIndex < count) { + newFilterPosts[index] = deepClone(posts[sourceIndex]); + index++; + } } - } } - setFilterPosts(newFilterPosts) - }, [columns, posts]) + + setFilterPosts(newFilterPosts); + }, [columns, posts]); if (!filterPosts || filterPosts.length === 0) { return diff --git a/themes/fukasawa/components/BlogListScroll.js b/themes/fukasawa/components/BlogListScroll.js index 22b21751..489b22c8 100644 --- a/themes/fukasawa/components/BlogListScroll.js +++ b/themes/fukasawa/components/BlogListScroll.js @@ -1,41 +1,36 @@ -import { siteConfig } from '@/lib/config' -import { useGlobal } from '@/lib/global' -import { useEffect, useRef, useState } from 'react' -import BlogCard from './BlogCard' -import BlogPostListEmpty from './BlogListEmpty' +import { siteConfig } from '@/lib/config'; +import { useGlobal } from '@/lib/global'; +import throttle from 'lodash.throttle'; +import { useCallback, useEffect, useRef, useState } from 'react'; +import BlogCard from './BlogCard'; +import BlogPostListEmpty from './BlogListEmpty'; + +const BlogListScroll = ({ posts }) => { + const { locale, NOTION_CONFIG } = useGlobal(); + const [page, setPage] = useState(1); + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG); + const [filterPostsGroups, setFilterPostsGroups] = useState([]); + + // 每页显示的文章数量 + const postsPerPage = POSTS_PER_PAGE; + + // 计算总页数 + const totalPages = Math.ceil(posts.length / postsPerPage); + + // 加载更多文章 + const loadMorePosts = () => { + if (page < totalPages) { + setPage(page + 1); + } + }; + -/** - * 文章列表分页表格 - * @param page 当前页 - * @param posts 所有文章 - * @param tags 所有标签 - * @returns {JSX.Element} - * @constructor - */ -const BlogListScroll = props => { - const { posts = [], siteInfo } = props - const { locale, NOTION_CONFIG } = useGlobal() const targetRef = useRef(null) - const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) - let hasMore = false - const postsToShow = posts - ? Object.assign(posts).slice(0, POSTS_PER_PAGE * page) - : [] - - if (posts) { - const totalCount = posts.length - hasMore = page * POSTS_PER_PAGE < totalCount - } - const handleGetMore = () => { - if (!hasMore) return - updatePage(page + 1) - } // 监听滚动自动分页加载 - const scrollTrigger = () => { - requestAnimationFrame(() => { + const scrollTrigger = useCallback( + throttle(() => { const scrollS = window.scrollY + window.outerHeight const clientHeight = targetRef ? targetRef.current @@ -43,47 +38,64 @@ const BlogListScroll = props => { : 0 : 0 if (scrollS > clientHeight + 100) { - handleGetMore() + loadMorePosts() } - }) - } + }, 500) + ) useEffect(() => { window.addEventListener('scroll', scrollTrigger) return () => { window.removeEventListener('scroll', scrollTrigger) } - }, []) + }) + + // 根据当前页和每页文章数截取应该显示的文章 + useEffect(() => { + const startIndex = (page - 1) * postsPerPage; + const endIndex = startIndex + postsPerPage; + const postsToShow = posts.slice(startIndex, endIndex); + const columns = 3; // 假设有3列 + + // 重新排列文章,保证列优先顺序 + const newFilterPosts = []; + for (let col = 0; col < columns; col++) { + for (let i = col; i < postsToShow.length; i += columns) { + newFilterPosts.push(postsToShow[i]); + } + } + + setFilterPostsGroups((prev) => [...prev, newFilterPosts]); + }, [posts, page]); if (!posts || posts.length === 0) { - return + return ; } else { return ( -
- {/* 文章列表 */} - {postsToShow?.map(post => ( -
- +
+ {filterPostsGroups.map((group, groupIndex) => ( +
+ {group.map((post) => ( +
+ 0}/> +
+ ))}
))} -
- {' '} - {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '} + className="w-full my-4 py-4 text-center cursor-pointer" + onClick={loadMorePosts} + > + {page < totalPages ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}
- ) + ); } -} +}; + +export default BlogListScroll; -export default BlogListScroll diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js index 2442259a..96936df8 100644 --- a/themes/fukasawa/index.js +++ b/themes/fukasawa/index.js @@ -114,12 +114,13 @@ const LayoutIndex = props => { * @param {*} props */ const LayoutPostList = props => { + const POST_LIST_STYLE = siteConfig('POST_LIST_STYLE') return ( <>
- {siteConfig('POST_LIST_STYLE') === 'page' ? ( + { POST_LIST_STYLE=== 'page' ? ( ) : ( diff --git a/themes/fukasawa/style.js b/themes/fukasawa/style.js index e730d919..bfb8bde6 100644 --- a/themes/fukasawa/style.js +++ b/themes/fukasawa/style.js @@ -44,7 +44,16 @@ const Style = () => { column-gap: .5rem; } } + + .container { + display: grid; + grid-template-columns: repeat(3, 1fr); + grid-gap: 10px; + padding: 10px; + } + `} } export { Style } + diff --git a/themes/game/components/BlogListScroll.js b/themes/game/components/BlogListScroll.js index 6fa04049..a46d0973 100644 --- a/themes/game/components/BlogListScroll.js +++ b/themes/game/components/BlogListScroll.js @@ -9,7 +9,7 @@ export const BlogListScroll = props => { const { posts } = props const { locale, NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) let hasMore = false const postsToShow = diff --git a/themes/heo/components/BlogPostListPage.js b/themes/heo/components/BlogPostListPage.js index 4239e233..bf791ae5 100644 --- a/themes/heo/components/BlogPostListPage.js +++ b/themes/heo/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import PaginationNumber from './PaginationNumber' */ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE if (!posts || posts.length === 0 || page > totalPage) { diff --git a/themes/heo/components/BlogPostListScroll.js b/themes/heo/components/BlogPostListScroll.js index 9fa7e736..8077e9fa 100644 --- a/themes/heo/components/BlogPostListScroll.js +++ b/themes/heo/components/BlogPostListScroll.js @@ -21,7 +21,7 @@ const BlogPostListScroll = ({ }) => { const { NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const postsToShow = getListByPage(posts, page, POSTS_PER_PAGE) let hasMore = false diff --git a/themes/hexo/components/BlogPostListPage.js b/themes/hexo/components/BlogPostListPage.js index c96b9cdd..ccc309bc 100644 --- a/themes/hexo/components/BlogPostListPage.js +++ b/themes/hexo/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import PaginationNumber from './PaginationNumber' */ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE if (!posts || posts.length === 0 || page > totalPage) { diff --git a/themes/hexo/components/BlogPostListScroll.js b/themes/hexo/components/BlogPostListScroll.js index b3f19036..11291051 100644 --- a/themes/hexo/components/BlogPostListScroll.js +++ b/themes/hexo/components/BlogPostListScroll.js @@ -21,7 +21,7 @@ const BlogPostListScroll = ({ }) => { const { NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const postsToShow = getListByPage(posts, page, POSTS_PER_PAGE) let hasMore = false diff --git a/themes/matery/components/BlogPostListPage.js b/themes/matery/components/BlogPostListPage.js index 8558d5e7..61d17db6 100644 --- a/themes/matery/components/BlogPostListPage.js +++ b/themes/matery/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import PaginationSimple from './PaginationSimple' */ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPagination = postCount >= POSTS_PER_PAGE if (!posts || posts.length === 0 || page > totalPage) { diff --git a/themes/matery/components/BlogPostListScroll.js b/themes/matery/components/BlogPostListScroll.js index 8a91bf07..4a8c166c 100644 --- a/themes/matery/components/BlogPostListScroll.js +++ b/themes/matery/components/BlogPostListScroll.js @@ -21,7 +21,7 @@ const BlogPostListScroll = ({ siteInfo }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const [page, updatePage] = useState(1) const postsToShow = getListByPage(posts, page, POSTS_PER_PAGE) // 监听滚动 diff --git a/themes/medium/components/BlogPostListPage.js b/themes/medium/components/BlogPostListPage.js index c8171c4b..79e031dd 100644 --- a/themes/medium/components/BlogPostListPage.js +++ b/themes/medium/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import PaginationSimple from './PaginationSimple' */ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) if (!posts || posts.length === 0) { diff --git a/themes/medium/components/BlogPostListScroll.js b/themes/medium/components/BlogPostListScroll.js index cf06a093..22960779 100644 --- a/themes/medium/components/BlogPostListScroll.js +++ b/themes/medium/components/BlogPostListScroll.js @@ -15,7 +15,7 @@ import BlogPostListEmpty from './BlogPostListEmpty' */ const BlogPostListScroll = ({ posts = [], currentSearch }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const [page, updatePage] = useState(1) const router = useRouter() let filteredPosts = Object.assign(posts) diff --git a/themes/movie/components/BlogListPage.js b/themes/movie/components/BlogListPage.js index 9ba62844..dade70d1 100644 --- a/themes/movie/components/BlogListPage.js +++ b/themes/movie/components/BlogListPage.js @@ -7,7 +7,7 @@ import PaginationNumber from './PaginationNumber' export const BlogListPage = props => { const { page = 1, posts, postCount } = props const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const showPageCover = siteConfig('MOVIE_POST_LIST_COVER', null, CONFIG) diff --git a/themes/nav/components/BlogPostListPage.js b/themes/nav/components/BlogPostListPage.js index 4594f3b8..5075a2a0 100755 --- a/themes/nav/components/BlogPostListPage.js +++ b/themes/nav/components/BlogPostListPage.js @@ -13,7 +13,7 @@ import PaginationSimple from './PaginationSimple' */ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { const totalPage = Math.ceil( - postCount / parseInt(siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG)) + postCount / parseInt(siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG)) ) if (!posts || posts.length === 0) { diff --git a/themes/nav/components/NavPostItem.js b/themes/nav/components/NavPostItem.js index d9ecde88..5ed7d65a 100755 --- a/themes/nav/components/NavPostItem.js +++ b/themes/nav/components/NavPostItem.js @@ -16,8 +16,6 @@ const NavPostItem = props => { const toggleOpenSubMenu = () => { changeIsOpen(!isOpen) } - console.log('group::') - console.log(group) if (group?.category) { return ( diff --git a/themes/next/components/BlogPostListPage.js b/themes/next/components/BlogPostListPage.js index c74fbbb2..87650a28 100644 --- a/themes/next/components/BlogPostListPage.js +++ b/themes/next/components/BlogPostListPage.js @@ -14,7 +14,7 @@ import PaginationNumber from './PaginationNumber' */ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) if (!posts || posts.length === 0) { diff --git a/themes/next/components/BlogPostListScroll.js b/themes/next/components/BlogPostListScroll.js index 1003d2b0..44db2010 100644 --- a/themes/next/components/BlogPostListScroll.js +++ b/themes/next/components/BlogPostListScroll.js @@ -19,7 +19,7 @@ const BlogPostListScroll = ({ showSummary = siteConfig('NEXT_POST_LIST_SUMMARY', null, CONFIG) }) => { const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const [page, updatePage] = useState(1) const postsToShow = getPostByPage(page, posts, POSTS_PER_PAGE) diff --git a/themes/nobelium/components/BlogListPage.js b/themes/nobelium/components/BlogListPage.js index 6998c522..ba1c2b4a 100644 --- a/themes/nobelium/components/BlogListPage.js +++ b/themes/nobelium/components/BlogListPage.js @@ -9,7 +9,7 @@ export const BlogListPage = props => { const { locale } = useGlobal() const router = useRouter() const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const currentPage = +page diff --git a/themes/plog/components/BlogListPage.js b/themes/plog/components/BlogListPage.js index 9224c16b..658c2377 100644 --- a/themes/plog/components/BlogListPage.js +++ b/themes/plog/components/BlogListPage.js @@ -10,7 +10,7 @@ export const BlogListPage = props => { const { locale } = useGlobal() const router = useRouter() const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const currentPage = +page diff --git a/themes/simple/components/BlogListPage.js b/themes/simple/components/BlogListPage.js index 1219aac7..f11d2cc2 100644 --- a/themes/simple/components/BlogListPage.js +++ b/themes/simple/components/BlogListPage.js @@ -15,7 +15,7 @@ export default function BlogListPage(props) { const { page = 1, posts, postCount } = props const router = useRouter() const { NOTION_CONFIG } = useGlobal() - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) const totalPage = Math.ceil(postCount / POSTS_PER_PAGE) const currentPage = +page diff --git a/themes/simple/components/BlogListScroll.js b/themes/simple/components/BlogListScroll.js index a1af6c77..2252a995 100644 --- a/themes/simple/components/BlogListScroll.js +++ b/themes/simple/components/BlogListScroll.js @@ -13,7 +13,7 @@ export default function BlogListScroll(props) { const { posts } = props const { locale, NOTION_CONFIG } = useGlobal() const [page, updatePage] = useState(1) - const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG) + const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', null, NOTION_CONFIG) let hasMore = false const postsToShow = posts ? Object.assign(posts).slice(0, POSTS_PER_PAGE * page)