Which URLs Belong in an XML Sitemap?

See which URLs belong in an XML sitemap, with include and exclude examples, absolute loc values, and a checklist for canonical pages and lastmod dates.

SharePost on XShare on LinkedIn
Watercolor illustration of selected cobalt paths entering a coral sitemap document while faint alternate paths remain outside

The short answer

Include the absolute canonical URLs you deliberately want search engines to discover and consider for search. Exclude redirects, error pages, noindex pages, duplicate and parameter variants, session URLs, and alternate URL versions unless a documented platform-specific use case requires them.

XML Sitemap Generator showing selected Overhyped canonical URLs beside generated sitemap XML and deployment guidance
The focused XML Sitemap Generator workspace using selected Overhyped URLs, captured 30 August 2026. Inclusion in the file does not guarantee crawling or indexing.

A sitemap is not a dump of every URL your server can return.

It is a maintained set of preferred public locations. The difficult work is choosing that set. Turning it into XML is the easy part.

If you first need to locate a website’s existing file, check its robots.txt declarations and common sitemap locations. Return here when the job is deciding which canonical URLs belong in the file.

Start from canonical intent

Google recommends including the canonical URLs you want to see in search results. Use complete absolute URLs, including the chosen protocol and host. See Google’s build-a-sitemap guidance.

For a typical site, one content page should have one preferred sitemap location. Do not list every tracking, sorting, session, print, mobile, and redirecting variant merely because it is reachable.

Exclude obvious non-candidates

Review and normally remove:

  • URLs that redirect elsewhere.
  • 4xx and 5xx responses.
  • Pages deliberately marked noindex.
  • Alternate URLs canonicalized to another page.
  • Duplicate parameter combinations.
  • Search results or infinite filters with no intended search value.
  • Private, authenticated, or environment-specific URLs.

Some exceptions exist. Confirm the site’s real architecture before applying rules in bulk.

Include and exclude examples

Suppose the preferred site is https://example.com and /about is a public page intended for search:

  • Include https://example.com/about when it returns the intended page, allows indexing, and is the preferred canonical version.
  • Exclude http://example.com/about when it redirects to the HTTPS version. List the final destination instead.
  • Exclude https://example.com/old-about when it redirects to /about, or returns an error without a relevant replacement.
  • Exclude https://example.com/about?utm_source=newsletter when it is only a tracking variant of the canonical page.
  • Exclude https://example.com/account when it requires authentication or is deliberately excluded from search.
  • Review https://example.com/products?category=chairs before excluding it. A parameter does not automatically make a page a duplicate; some filtered pages have distinct content and a deliberate search purpose.

Do not remove a useful canonical page simply because it is not indexed yet. The sitemap expresses the intended inventory; Google’s indexing decision is a separate observation.

Why a sitemap loc must be an absolute URL

Every <loc> needs an absolute URL with its protocol and hostname. If your sitemap generator outputs /about for a page whose preferred address is https://example.com/about, you can reproduce the problem in the XML Sitemap Validator.

Paste this well-formed XML into the validator and select Validate sitemap. The checker flags the relative location.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>/about</loc></url>
</urlset>

Change only the value inside <loc> and run it again. The location error clears.

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://example.com/about</loc></url>
</urlset>

For a real site, use the page’s preferred URL. If the absolute URL redirects, returns an error, or points to a duplicate, review which destination belongs in the sitemap. A location can pass the format check while pointing to the wrong page. Escape ampersands in meaningful query strings as &amp; in XML. The sitemap protocol documents both requirements.

Absolute and relative loc examples

An absolute location includes its scheme and hostname; the sitemap’s own address does not turn a relative value into a valid location.

Value inside <loc> Review
https://example.com/about A complete HTTPS address; separately confirm it is the intended canonical page.
/about Relative path: add the intended scheme and hostname in the sitemap’s source generator.
//example.com/about Missing scheme: use the complete address rather than relying on a browser’s current protocol.

Fix the source that generates the locations, then regenerate and validate the XML. Do not change the site’s canonical hostname or redirect rules merely to make a validator warning disappear. Google’s sitemap guidance also requires fully qualified URLs.

In a sitemap index, a <loc> identifies a child sitemap file instead of a content page. Check that each child file contains the intended page inventory. The XML Sitemap Validator checks the supplied file; it does not open all its child files or verify every destination.

Which tags belong in a basic XML sitemap?

For a standard URL sitemap, the tags describe a file of page locations; they are not the headings used in the page itself.

Element Role
urlset Required outer element with the sitemap namespace.
url Required parent for each page entry.
loc Required child containing that page’s full URL.
lastmod Optional page modification date, only when it can be maintained accurately.
h1 An HTML heading, not a standard URL-sitemap element.

The protocol’s XML tag definitions describe these relationships. A sitemap index uses a different root and lists sitemap files; do not combine the two structures.

Keep discovery and indexability separate

Being in a sitemap does not override robots controls, authentication, canonicals, or noindex directives. It also does not prove that a search engine has indexed the page.

Use a sitemap generator only after the URL set has been reviewed. Use page-level checks and Search Console separately when you need eligibility or private indexing evidence.

Use lastmod only when it is meaningful

An optional lastmod value can communicate a meaningful page change. It should not be refreshed because the sitemap was regenerated or because a footer changed across the site.

If your CMS cannot supply trustworthy modification dates, omit the field. Incorrect precision is not useful precision.

Generate from a durable source

For a small static website, a reviewed route list can be enough. As the site grows, generate the sitemap from the same database, CMS, or build process that knows the canonical public routes.

Manual XML becomes stale. Source-generated XML keeps changes reviewable and repeatable.

Verify after generation

  1. Deduplicate URLs and remove fragments.
  2. Confirm all locations are absolute HTTP or HTTPS URLs.
  3. Review mixed origins deliberately.
  4. Validate the XML structure and file limits.
  5. Publish the file at its intended public URL.
  6. Confirm the live response, content type, and declarations.
  7. Submit or monitor it in the appropriate search-engine property when available.

Google’s sitemap limits are 50,000 URLs or 50 MB uncompressed per file. Split larger sets and use a sitemap index where appropriate.

What generation cannot guarantee

A generated file is not automatically a useful file. It cannot decide which pages support the business, which duplicates should consolidate, or whether Google will crawl or index a location.

Generate sitemap XML from a reviewed canonical URL list with the free XML Sitemap Generator, then validate the deployed file separately.

If URL selection is part of a wider migration or recurring crawl and indexing problem, review how Overhyped scopes managed SEO and AEO work before onboarding. The exact implementation responsibilities are agreed in writing for each engagement.

Method note: generation happens in the browser from the URLs entered. The tool does not crawl the site or upload the result. The fictional examples above illustrate URL selection, not measured indexing results. Last reviewed 15 November 2026.

Continue learning

Keep moving with a closely related topic and a free tool you can use immediately.

Watercolor illustration of two policy snapshots and branching crawl paths, with a coral changed rule closing one gate

Robots.txt Monitoring: Detect Changes and Test Their Impact

Build a practical robots.txt monitoring routine with saved snapshots, a tested change example, critical URL checks and a clear response plan.

Watercolor illustration of product, use-case, integration and documentation cards joined by a coral path

SaaS SEO Audit: Check Product, Use-Case and Documentation Journeys

Audit SaaS search journeys with a four-page public example and a reusable worksheet connecting product fit, use cases, integrations and documentation.

Watercolor audit worksheet connected to webpage evidence and a coral repair-and-retest path

Technical SEO Audit Checklist: Evidence, Owners and Retesting

Run a practical technical SEO audit with a downloadable worksheet for page coverage, verified findings, repair owners and post-deployment retesting.