Sitemap lists hundreds of URLs that declare a different canonical

Open Beginner friendly
#2,568 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@NopeCharon is already working on this.

Since Nov 6, 2026.

  • #2569 by @NopeCharon — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, node.js
Domain
documentation

Research direction

Start with the sitemap filter in astro.config.mjs and review the canonical URL declarations added in #2432 alongside the filter change in #2430. Compare generated sitemap entries with each page’s canonical URL to find why 635 entries differ. Done means the sitemap contains only pages whose listed URL is their own canonical.

Written by the indexing model from the issue text.

Description

Environment information

Version: main at 854213b2 and the live site, https://expressjs.com

Platform: not relevant, this is generated build output

Node.js version: not relevant

Any other relevant information: the filter in astro.config.mjs says "Only the canonical URLs belong in the sitemap", and it was tightened with that goal in #2430. The canonical URLs themselves were declared in #2432, but the sitemap filter doesn't take them into account.

What steps will reproduce the bug?

  1. Open https://expressjs.com/sitemap-0.xml.
  2. Compare each <loc> with the rel="canonical" of that page.

Of the 1,311 URLs listed, 635 declare a different page as canonical:

Listed in the sitemap Canonical
/en/ /
/en/guide/routing/, /es/guide/routing/ /en/5x/guide/routing/, /es/5x/guide/routing/
/en/api/express/ /en/5x/api/express/
/es/5x/api/express/ /en/5x/api/express/
/es/blog/2024-10-15-v5-release/ /en/blog/2024-10-15-v5-release/

Sending search engines conflicting signals like this can make them ignore the sitemap's hints and spend crawl budget on duplicates.

Expected: the sitemap lists only pages that are their own canonical URL.

Dominant language
MDX
Stars
5.4k
Forks
2.3k
Avg merge
2d 23h
Merged PRs (30d)
28

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/expressjs.com

All issues in expressjs/expressjs.com

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.