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

Add trailing slash to auto generated sitemap.xml #4134

Closed
kkhoury38 opened this issue Jan 31, 2021 · 1 comment
Closed

Add trailing slash to auto generated sitemap.xml #4134

kkhoury38 opened this issue Jan 31, 2021 · 1 comment
Labels
proposal This issue is a proposal, usually non-trivial change

Comments

@kkhoury38
Copy link

kkhoury38 commented Jan 31, 2021

💥 Add a trailing slash to the urls generated in sitemap.xml

Urls in sitemap.xml are currently listed without a trailing slash (i.e. ./blog instead of ./blog/), while, when going to the page, it redirects to the url with a trailing slash (i.e ./blog redirects to ./blog/)

This results in google indexing the page with a "redirect error".

A temporary fix for user created content pages is to add a trailing slash on the "slag" property value. This will not work though on all pages that are automatically generated by docusaurus. Pages include:

/blog
/blog/tags
/blog/tags/TAG_NAME

The proposal is to add a trailing slash to those urls when generating sitemap.xml

Current version:

@docusaurus/core: 2.0.0-alpha.69,
@docusaurus/preset-classic: 2.0.0-alpha.69,

Example sitemap

https://atman-iot.com/sitemap.xml

Issue example

@kkhoury38 kkhoury38 added status: needs triage This issue has not been triaged by maintainers proposal This issue is a proposal, usually non-trivial change labels Jan 31, 2021
@slorber
Copy link
Collaborator

slorber commented Feb 1, 2021

I would suggest you should rather configure your host to serve the pages without the trailing slash (not always possible though...). Related to #3372.

Otherwise, there's already an option in the sitemaps plugin: https://v2.docusaurus.io/docs/next/api/plugins/@docusaurus/plugin-sitemap/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

3 participants