Skip to content

Redirects are incorrectly included in the sitemap #2075

@ntotten

Description

@ntotten

Description

Redirect routes defined in the Zudoku config are being included in the generated sitemap. This causes redirect URLs to appear in the sitemap, which is undesirable since they don't represent actual content pages.

Steps to Reproduce

  1. Define a redirect in zudoku.config.tsx:
    redirects: [
      {
        from: "/dev-portal/zudoku/theme-playground",
        to: "https://zudoku.dev/docs/theme-playground",
      },
    ],
  2. Build the site
  3. Check the generated sitemap.xml

Expected Behavior

Redirect routes should be excluded from the sitemap since they don't serve actual content — they just redirect to another URL.

Actual Behavior

The redirect path (e.g., https://zuplo.com/docs/dev-portal/zudoku/theme-playground) appears in the sitemap as a regular page entry.

Root Cause

The redirectPlugin registers routes via getRoutes(), and the sitemap generator in sitemap.js iterates over all routes returned by routesToPaths() without distinguishing between content routes and redirect routes.

Suggested Fix

Filter out redirect routes when generating the sitemap, either by:

  • Marking redirect routes with metadata so the sitemap generator can skip them
  • Filtering paths that correspond to redirects in generateSitemap()

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions