fix(content-blog): remove double leading slash in blog-only paginated view (#6918)

* fix(content-blog): Fix permalink function of paginateBlogPosts

* add test

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
WonChul Heo 2022-03-15 17:45:05 +09:00 committed by GitHub
parent f4f4c1dfd8
commit 46b1027c4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 226 additions and 51 deletions

View file

@ -72,7 +72,9 @@ export function paginateBlogPosts({
const pages: BlogPaginated[] = [];
function permalink(page: number) {
return page > 0 ? `${basePageUrl}/page/${page + 1}` : basePageUrl;
return page > 0
? normalizeUrl([basePageUrl, `page/${page + 1}`])
: basePageUrl;
}
for (let page = 0; page < numberOfPages; page += 1) {