feat(blog): add blog pageBasePath plugin option (#9838)

Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
Liviu Ionescu 2024-02-13 14:27:23 +02:00 committed by GitHub
parent cc7f43580c
commit 70ba9d2d01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 113 additions and 21 deletions

View file

@ -57,12 +57,14 @@ export function paginateBlogPosts({
blogTitle,
blogDescription,
postsPerPageOption,
pageBasePath,
}: {
blogPosts: BlogPost[];
basePageUrl: string;
blogTitle: string;
blogDescription: string;
postsPerPageOption: number | 'ALL';
pageBasePath: string;
}): BlogPaginated[] {
const totalCount = blogPosts.length;
const postsPerPage =
@ -73,7 +75,7 @@ export function paginateBlogPosts({
function permalink(page: number) {
return page > 0
? normalizeUrl([basePageUrl, `page/${page + 1}`])
? normalizeUrl([basePageUrl, pageBasePath, `${page + 1}`])
: basePageUrl;
}
@ -111,6 +113,7 @@ export function getBlogTags({
blogTitle: string;
blogDescription: string;
postsPerPageOption: number | 'ALL';
pageBasePath: string;
}): BlogTags {
const groups = groupTaggedItems(
blogPosts,