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

Incorrect sitemap URLs when baseURL != / #901

Closed
shaform opened this issue Aug 12, 2018 · 5 comments · Fixed by #902
Closed

Incorrect sitemap URLs when baseURL != / #901

shaform opened this issue Aug 12, 2018 · 5 comments · Fixed by #902
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@shaform
Copy link
Contributor

shaform commented Aug 12, 2018

🐛 Bug Report

According to the documentation:

For github.io type URLS, you would combine the URL and baseUrl like:
url: 'https://reasonml.github.io',
baseUrl: '/reason-react/',

So we should set url as https://reasonml.github.io even though the root of the docs is https://reasonml.github.io/reason-react/.

But if we set it like that, the URLs in sitemaps would be:

While it should be:

Have you read the Contributing Guidelines on issues?

yes

To Reproduce

  1. Create a new website

  2. Set siteConfig.js as

    url: 'https://reasonml.github.io',
    baseUrl: '/reason-react/', 
    
  3. Take a look at the generated sitemap.xml.

Expected behavior

The URLs should be like https://reasonml.github.io/reason-react/examples.

Actual Behavior

The URLs would be like https://reasonml.github.io/examples.

Reproducible Demo

The actual reason-react actually set url as https://reasonml.github.io/reason-react. See https://github.com/reasonml/reason-react/blob/1420cba22ad35eb8fd257a58957f1e4047c55034/website/siteConfig.js#L80.

So perhaps this is just a documentation error?

@endiliey
Copy link
Contributor

@shaform
Copy link
Contributor Author

shaform commented Aug 12, 2018

Hi @endiliey, as the actual reason-react set url as https://reasonml.github.io/reason-react instead of https://reasonml.github.io. Their sitemap.xml https://reasonml.github.io/reason-react/sitemap.xml is correct.

However, the documentation says that we should set it as https://reasonml.github.io. See https://github.com/facebook/Docusaurus/blob/master/docs/api-site-config.md. And if we follow the documentation, the sitemap would be incorrect.

@endiliey
Copy link
Contributor

endiliey commented Aug 12, 2018

@shaform

Great catch. Thanks for reporting. This is a bug.
react-native

Do you want to try sending a PR ?
We should add the baseUrl part

https://github.com/facebook/Docusaurus/blob/8f9f7a560236abdd403bbc1b7b0313dd99f65a2e/lib/server/sitemap.js

@shaform
Copy link
Contributor Author

shaform commented Aug 12, 2018

Sure, I'll try to come up with a PR today.

@endiliey
Copy link
Contributor

endiliey commented Aug 12, 2018

This part
https://github.com/facebook/Docusaurus/blob/8f9f7a560236abdd403bbc1b7b0313dd99f65a2e/lib/server/sitemap.js#L86

should be something like

hostname: siteConfig.url + siteConfig.baseUrl

Then it will be fixed if baseUrl is /test/ and url is https://docusaurus.io
fixed

Will wait for your PR 😃

@endiliey endiliey added the bug An error in the Docusaurus core causing instability or issues with its execution label Aug 12, 2018
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants