Skip to content

Commit

Permalink
Merge pull request tangly1024#1195 from tangly1024/fix/url-page
Browse files Browse the repository at this point in the history
fix-url-when-switch-theme
  • Loading branch information
tangly1024 authored Jun 23, 2023
2 parents c5ddc8c + 5508439 commit aaa3c4c
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion themes/example/components/BlogListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const BlogListPage = props => {

const showPrev = currentPage > 1
const showNext = page < totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

const showPageCover = CONFIG_EXAMPLE.POST_LIST_COVER

Expand Down
2 changes: 1 addition & 1 deletion themes/fukasawa/components/PaginationSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const PaginationSimple = ({ page, showNext }) => {
const { locale } = useGlobal()
const router = useRouter()
const currentPage = +page
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div className="my-10 flex justify-between font-medium text-black dark:text-gray-100 space-x-2">
Expand Down
2 changes: 1 addition & 1 deletion themes/hexo/components/PaginationNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PaginationNumber = ({ page, totalPage }) => {
const router = useRouter()
const currentPage = +page
const showNext = page < totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pages = generatePages(pagePrefix, page, currentPage, totalPage)

return (
Expand Down
2 changes: 1 addition & 1 deletion themes/matery/components/PaginationNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PaginationNumber = ({ page, totalPage }) => {
const router = useRouter()
const currentPage = +page
const showNext = page < totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pages = generatePages(pagePrefix, page, currentPage, totalPage)

return (
Expand Down
2 changes: 1 addition & 1 deletion themes/matery/components/PaginationSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +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(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div className="my-10 mx-6 flex justify-between font-medium text-black dark:text-gray-100 space-x-2">
Expand Down
2 changes: 1 addition & 1 deletion themes/medium/components/PaginationSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div className="my-10 flex justify-between font-medium text-black dark:text-gray-100 space-x-2">
Expand Down
2 changes: 1 addition & 1 deletion themes/next/components/PaginationNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const PaginationNumber = ({ page, totalPage }) => {
const router = useRouter()
const currentPage = +page
const showNext = page !== totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pages = generatePages(pagePrefix, page, currentPage, totalPage)

return (
Expand Down
2 changes: 1 addition & 1 deletion themes/next/components/PaginationSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const PaginationSimple = ({ page, showNext }) => {
const { locale } = useGlobal()
const router = useRouter()
const currentPage = +page
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div
Expand Down
4 changes: 2 additions & 2 deletions themes/nobelium/components/BlogListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const BlogListPage = props => {

const showPrev = currentPage > 1
const showNext = page < totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div className="w-full md:pr-12 mb-12">
Expand Down Expand Up @@ -46,5 +46,5 @@ export const BlogListPage = props => {
</Link>
</div>
</div>
);
)
}
2 changes: 1 addition & 1 deletion themes/simple/components/BlogListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const BlogListPage = props => {

const showPrev = currentPage > 1
const showNext = page < totalPage
const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')

return (
<div className="w-full md:pr-8 mb-12">
Expand Down

0 comments on commit aaa3c4c

Please sign in to comment.