mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +02:00
chore(v2): use normalizeUrl instead of path.join (#1428)
* chore(v2): use normalizeUrl instead of path.join * address review
This commit is contained in:
parent
a4ca603222
commit
a1ee1ab140
1 changed files with 5 additions and 5 deletions
|
@ -99,15 +99,15 @@ class DocusaurusPluginContentBlog {
|
||||||
// Blog page handling. Example: `/blog`, `/blog/page1`, `/blog/page2`
|
// Blog page handling. Example: `/blog`, `/blog/page1`, `/blog/page2`
|
||||||
const numOfBlog = blogMetadata.length;
|
const numOfBlog = blogMetadata.length;
|
||||||
const numberOfPage = Math.ceil(numOfBlog / pageCount);
|
const numberOfPage = Math.ceil(numOfBlog / pageCount);
|
||||||
const basePageUrl = path.join(baseUrl, routeBasePath);
|
const basePageUrl = normalizeUrl([baseUrl, routeBasePath]);
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
for (let page = 0; page < numberOfPage; page++) {
|
for (let page = 0; page < numberOfPage; page++) {
|
||||||
blogMetadata.push({
|
blogMetadata.push({
|
||||||
permalink: normalizeUrl([
|
permalink:
|
||||||
basePageUrl,
|
page > 0
|
||||||
`${page > 0 ? `page${page + 1}` : ''}`,
|
? normalizeUrl([basePageUrl, `page/${page + 1}`])
|
||||||
]),
|
: basePageUrl,
|
||||||
language: defaultLangTag,
|
language: defaultLangTag,
|
||||||
isBlogPage: true,
|
isBlogPage: true,
|
||||||
posts: blogMetadata.slice(page * pageCount, (page + 1) * pageCount),
|
posts: blogMetadata.slice(page * pageCount, (page + 1) * pageCount),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue