diff --git a/themes/fukasawa/components/PaginationSimple.js b/themes/fukasawa/components/PaginationSimple.js index cbbf23d0..861cd76d 100644 --- a/themes/fukasawa/components/PaginationSimple.js +++ b/themes/fukasawa/components/PaginationSimple.js @@ -47,7 +47,7 @@ const PaginationSimple = ({ page, showNext }) => { {locale.PAGINATION.NEXT}→ - ); + ) } export default PaginationSimple diff --git a/themes/hexo/components/PaginationNumber.js b/themes/hexo/components/PaginationNumber.js index 0eb0b001..0ebdade7 100644 --- a/themes/hexo/components/PaginationNumber.js +++ b/themes/hexo/components/PaginationNumber.js @@ -47,7 +47,7 @@ const PaginationNumber = ({ page, totalPage }) => { - ); + ) } function getPageElement(page, currentPage, pagePrefix) { @@ -66,7 +66,7 @@ function getPageElement(page, currentPage, pagePrefix) { {page} ) - ); + ) } function generatePages(pagePrefix, page, currentPage, totalPage) { diff --git a/themes/matery/components/PaginationSimple.js b/themes/matery/components/PaginationSimple.js index 6605e64c..3e0ee2e5 100644 --- a/themes/matery/components/PaginationSimple.js +++ b/themes/matery/components/PaginationSimple.js @@ -1,4 +1,3 @@ -import BLOG from '@/blog.config' import Link from 'next/link' import { useRouter } from 'next/router' @@ -13,6 +12,7 @@ const PaginationSimple = ({ page, totalPage }) => { const router = useRouter() const currentPage = +page const showNext = currentPage < totalPage + const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') return (
@@ -20,8 +20,8 @@ const PaginationSimple = ({ page, totalPage }) => { href={{ pathname: currentPage - 1 === 1 - ? `${BLOG.SUB_PATH || '/'}` - : `/page/${currentPage - 1}`, + ? `${pagePrefix}/` + : `${pagePrefix}/page/${currentPage - 1}`, query: router.query.s ? { s: router.query.s } : {} }} passHref @@ -36,7 +36,7 @@ const PaginationSimple = ({ page, totalPage }) => { { {locale.PAGINATION.NEXT}→
- ); + ) } export default PaginationSimple diff --git a/themes/next/components/PaginationSimple.js b/themes/next/components/PaginationSimple.js index 3a1b0101..39005382 100644 --- a/themes/next/components/PaginationSimple.js +++ b/themes/next/components/PaginationSimple.js @@ -1,4 +1,3 @@ -import BLOG from '@/blog.config' import Link from 'next/link' import { useRouter } from 'next/router' import { useGlobal } from '@/lib/global' @@ -14,6 +13,8 @@ const PaginationSimple = ({ page, showNext }) => { const { locale } = useGlobal() const router = useRouter() const currentPage = +page + const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') + return (
{ href={{ pathname: currentPage - 1 === 1 - ? `${BLOG.SUB_PATH || '/'}` - : `/page/${currentPage - 1}`, + ? `${pagePrefix}/` + : `${pagePrefix}/page/${currentPage - 1}`, query: router.query.s ? { s: router.query.s } : {} }} passHref