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