All entries

    Test a Sitemap Before Deploying a React Site

    Test a generated sitemap against the built pages and an explicit list of eligible routes before deployment.

    A magnifying glass compares a route list with a sitemap
    Conceptual pixel-art illustration.

    Test a generated sitemap against the built pages and an explicit list of eligible routes before deployment.

    Build the example

    Parse XML with a parser and collect canonical locations. Reject duplicates, unexpected origins, drafts, fragment URLs and paths without built HTML. Verify the reverse mapping too: every intended indexable route should appear exactly once. For a server-rendered site, use the route registry or preview responses instead of requiring a physical HTML file.

    Make the fixture include a URL whose trailing slash differs from the canonical HTML. A local file may exist for that URL while the live host returns a redirect, so check the public response as a separate deployment smoke test. Report drafts, duplicates, missing pages and redirecting canonicals as different failure categories.

    EXPLAINED / SIDE BY SIDE

    Two-way sitemap coverage

    Test a generated sitemap against the built pages and an explicit list of eligible routes before deployment.

    Example

    1. Sitemap to registry

      reject unexpected or ineligible routes

    2. Registry to sitemap

      find missing routes

    3. HTML

      check canonical and indexability

    THE KEY DISTINCTION

    check canonical and indexability

    Conceptual diagram for the synthetic example in this guide.

    Watch the failure boundary

    Store a list of expected canonical routes from the same content registry used to render pages. Keep the assertion independent enough to catch accidental exclusions, such as verifying known public posts as fixtures. Include sitemap escaping and XML parsing in the test if any URL can contain characters with XML meaning.

    Verify the behavior

    Create a fixture with a duplicate, a draft and an omitted article. Report all three independently. Check that the final HTML canonical agrees with the sitemap location. Sitemap inclusion helps discovery and should be reported separately from whether a search engine selected the URL.

    FURTHER READING

    Sources

    Technical references checked .

    END OF ENTRY / 76
    Eeshan Singh with Big Ben in London
    BEHIND THE JOURNAL

    Eeshan Singh

    I’m Eeshan Singh Pokharia, an AI Full Stack Developer and CoFounder of UltraFit360. I work across AI features, full-stack product development, and web and mobile experiences—from Figma and frontend interactions to the systems behind them.

    Store a list of expected canonical routes from the same content registry used to render pages. Keep the assertion independent enough to catch accidental exclusions, such as verifying known public posts as fixtures. Include sitemap escaping and XML parsing in the test if any URL can contain characters with XML meaning.

    Meet the author
    THE CONVERSATION

    Your side of the story.