Skip to content

[v2] Sitemap contains links that result in 302s #2134

Closed

Description

@binarylogic

🐛 Bug Report

Hi. This isn't necessarily a bug report, but it is typically bad SEO practice for the sitemap to contain redirects. This is due to the fact that the URLs contained do not end with a /. This is a wider spread problem with linking in general across docusaurus, so I'm curious to hear what you think.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Open https://vector.dev/sitemap.xml

  2. Notice that https://vector.dev/blog is contained.

  3. Notice accessing the URL results in a 302:

    curl -v -s https://vector.dev/blog > /dev/null
    
  4. The destination is https://vector.dev/blog/

Expected behavior

For the sitemap to point to the final URL.


It's possible that this does not affect SEO at all, but I wanted to bring it your attention in the event it does.

Activity

  1. added
    bug
    status: needs triage
    on Dec 17, 2019
  2. lex111 commented on Dec 21, 2019

    @lex111
    Contributor

    I think it depends more on the static site hosting provider. Or maybe not, because without trailing slash, this is about working with client navigation, so we really can safely add a slash at the end of the links.

  3. endiliey commented on Dec 25, 2019

    @endiliey
    Contributor

    Its because we're using client side navigation and during HTML rendering phase, it will render /test as /text/index.html.

    However, depending on site hosting provider, it could request /test/index.html or /test.html when accessing /test for first page load (before client nav takes over)`.

    Its a hard call to be honest :( not sure whats the best approach

  4. removed
    status: needs triage
    on Dec 25, 2019
  5. added
    difficulty: intermediate
    mlh
    on Jun 5, 2020
  6. yangshun commented on Jun 5, 2020

    @yangshun
    Contributor

    Seems like vector.dev uses a custom sitemap plugin that fixes this issue. Plugin src here.

    I think we should standardize and make all the internal routes end with trailing slashes, for docs, sitemaps, and stuff. cc @lex111 @slorber

  7. slorber commented on Jun 5, 2020

    @slorber
    Collaborator

    I'm not against but don't really know the potential impact of such change, as it's related to how host providers serve files, and I'm not familiar with all that we currently support :)

  8. slorber commented on Jun 10, 2021

    @slorber
    Collaborator

    The next release includes a trailingSlash: true config option to force a trailing slash in links, URLs, canonical URLs, hreflang metas...

    See #3372

    Use https://github.com/slorber/trailing-slash-guide to understand how your hosting provider behaves when serving the historical filename pattern /path/index.html (file created for /path).

    Some hosts won't add any redirect / trailing slash, like Netlify (pretty URLs disabled) or Vercel, while others (Github Pages, Netlify with pretty URLs enabled) will redirect to a trailing slash

    So you can upgrade and use trailingSlash, or change host

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdifficulty: intermediatemlh

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions