Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] 404.html routePath does not include siteConfig.baseUrl #2229

Closed
cmfcmf opened this issue Jan 19, 2020 · 0 comments · Fixed by #2237 or #2854
Closed

[v2] 404.html routePath does not include siteConfig.baseUrl #2229

cmfcmf opened this issue Jan 19, 2020 · 0 comments · Fixed by #2237 or #2854
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@cmfcmf
Copy link
Contributor

cmfcmf commented Jan 19, 2020

🐛 Bug Report

The routesPaths parameter passed to the postBuild lifecycle event contains the wrong path to the 404.html file if you have a baseUrl configured in docusaurus.config.js.

This results in wrong data generated by plugins that access the routesPaths parameter. An example is the sitemap plugin, which generates an invalid sitemap entry.

Have you read the Contributing Guidelines on issues?

Yes :)

To Reproduce

  1. Set the baseUrl to something different than just / in docusuaurus.config.json.
  2. Build the documentation and log the routesPaths parameter in a plugin's postBuild lifecycle callback. You'll see the wrong path to the 404 file.
  3. Open the generates sitemap. Again, the path to the 404 file is wrong.

Expected behavior

I would expect the routesPaths to look like this:

[ 
'/base-url/404.html',
'/base-url/',
'/base-url/docs/getting-started',
]

and the sitemap to contain:

<!-- ... -->
<url>
<loc>https://example.com/base-url/404.html</loc>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<!-- ... -->

Actual Behavior

Currently, routesPaths look like this:

[ 
'404.html',
'/base-url/',
'/base-url/docs/getting-started',
]

The sitemap.xml file looks like this:

<!-- ... -->
<url>
<loc>https://example.com/404.html</loc>
<changefreq>weekly</changefreq>
<priority>0.5</priority>
</url>
<!-- ... -->

Reproducible Demo

To reproduce, build the documentation inside the docs folder of https://github.com/cmfcmf/OpenWeatherMap-PHP-API.

@cmfcmf cmfcmf added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
1 participant