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

fix(v2): sitemap should respect the global trailingSlash config option. #5068

Merged

Conversation

taylorreece
Copy link
Contributor

Motivation

Sitemap has a depricated option, trailingSlash. When used, URLs in the sitemap have trailing slashes, but you see a warning:

Option "trailingSlash" of the sitemap plugin is deprecated: Please use the new Docusaurus global trailingSlash config instead, and the sitemaps plugin will use it.

If you remove the trailingSlash option from the sitemap plugin, and instead have a global trailingSlash option set to true, the generated sitemap lacks trailing slashes.

This PR causes the sitemap plugin to respect the global trailingSlash option.

Have you read the Contributing Guidelines on pull requests?

yes

Test Plan

Within website I explicitly set the global trailingSlash option to true, and then false, to verify that trailing slashes are generated (or not) respectively.

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jun 25, 2021
@netlify
Copy link

netlify bot commented Jun 25, 2021

✔️ [V2]

🔨 Explore the source changes: a491d7c

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60dadd076764830008805905

😎 Browse the preview: https://deploy-preview-5068--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Jun 25, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 84
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5068--docusaurus-2.netlify.app/

@slorber
Copy link
Collaborator

slorber commented Jun 26, 2021

🤦 my PR didn't work #4950 I don't even read siteConfig 😅

thanks for noticing this!

It's not exactly how I want to fix this. The previous option should do "nothing" on trailingSlash: false (default option value) while applyTrailingSlash will actually remove a trailing slash (you may use slug: /x/y/z/ and don't want the trailing slash to be removed by default.

I'll edit your PR and add tests on monday

@taylorreece
Copy link
Contributor Author

Awesome, thanks, @slorber !

@slorber slorber changed the title Sitemap should respect the global trailingSlash config option. fix(v2): sitemap should respect the global trailingSlash config option. Jun 29, 2021
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Jun 29, 2021
@slorber slorber merged commit 41b7846 into facebook:master Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants