Skip to content
SimpleTools24

XML Sitemap Best Practices: What to Include and Avoid

By SimpleTools24Published 4 min read

A good XML sitemap lists only the URLs you want indexed: canonical pages that return HTTP 200, aren't blocked by robots.txt and aren't marked noindex. It uses absolute HTTPS URLs, includes a <lastmod> date only when it reflects real content changes, stays within 50,000 URLs and 50 MB per file (using a sitemap index for more), and is generated automatically so it never drifts out of date. Google ignores <priority> and <changefreq>, so there's no need to tune them.

1. Include Only Indexable, Canonical URLs

Every URL in your sitemap is a statement: "this is a page I want in search results". Mixed signals make the sitemap less useful to search engines.

What belongs in a sitemap
URL typeInclude?Why
Canonical content pages returning 200YesThese are what you want indexed
Pages that redirectNoList the destination instead
404 or 410 pagesNoThey no longer exist
Pages with noindexNoContradicts the sitemap
Pages blocked in robots.txtNoGoogle can't crawl them
Parameter or tracking variantsNoDuplicates of the canonical
Paginated archives (page 2, 3...)Usually noInclude if they have unique value
Login, cart, account, search resultsNoNot useful in search

In Search Console, URLs flagged as "Page with redirect", "Excluded by noindex" or "Duplicate" that come from your sitemap are a sign it needs cleaning.

2. Use the Exact Canonical Form

Match protocol, host and trailing slash to your canonical tags:

  • https:// not http://
  • www. or not, consistently
  • /page vs /page/, whichever your site uses as canonical

Listing a slightly different variant forces Google to resolve the difference and dilutes the signal.

3. Make lastmod Accurate (or Leave It Out)

Google has said it uses <lastmod> when it's consistently and verifiably accurate. That means the date should change when the page's main content changes, not when a footer updates or the sitemap is regenerated.

Bad practices:

  • Setting every URL's lastmod to today on each rebuild
  • Using the server time of the request
  • Changing dates without changing content to "look fresh"

If you can't produce accurate dates, omitting <lastmod> is better than providing misleading ones. Dates use W3C Datetime format, for example 2026-10-07 or 2026-10-07T09:30:00+00:00.

4. Don't Bother With priority and changefreq

Both tags are part of the sitemap protocol, and other search engines may read them, but Google ignores them. They're harmless, but tuning them is wasted effort.

5. Respect the Size Limits

Each sitemap file can contain up to 50,000 URLs and must be no larger than 50 MB uncompressed. Larger sites split URLs into multiple sitemaps and list them in a sitemap index:

xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap><loc>https://example.com/sitemap-pages.xml</loc></sitemap>
  <sitemap><loc>https://example.com/sitemap-blog.xml</loc></sitemap>
</sitemapindex>

Splitting by section (pages, blog, products) has a bonus: Search Console reports per sitemap, so you can see indexing for each section separately.

6. Generate It Automatically

The most common sitemap problem is staleness: deleted pages remain, new pages are missing. A sitemap generated by your CMS or framework at build or request time stays accurate. A static file needs regenerating whenever you add, remove or rename pages.

7. Make It Easy to Find

  • Publish at the root: https://example.com/sitemap.xml
  • Add Sitemap: https://example.com/sitemap.xml to robots.txt
  • Submit it in Google Search Console and Bing Webmaster Tools; see how to submit a sitemap

8. Keep It Technically Valid

UTF-8 encoding, escaped special characters (&amp;), absolute URLs, the correct namespace, and nothing printed before the <?xml declaration. Parsing failures show up as "Couldn't fetch" or "Has errors" in Search Console; fixing "Sitemap couldn't fetch" lists the usual suspects.

A sitemap helps discovery, but internal links tell search engines how pages relate and which ones matter. Pages that appear only in the sitemap, with no links from other pages, often struggle to get indexed. XML vs HTML sitemaps discusses finding these orphan pages.

Checking Your Sitemap

When auditing, compare three lists: the URLs in your sitemap, the URLs a crawler can reach from your home page, and the URLs Search Console reports as indexed. The XML sitemap generator helps with the first two: it crawls your public site by following links (respecting robots.txt), lets you review and remove URLs, and outputs valid, deduplicated XML, splitting large lists automatically. Its Paste URLs mode builds a sitemap from an export without crawling.

Frequently Asked Questions

Should every page be in the sitemap?

Every page you want indexed, yes. Pages you don't want in search results should be left out.

How often should a sitemap be updated?

Whenever URLs are added, removed or significantly changed. Automatic generation handles this for you.

Can a sitemap list URLs on another domain?

Generally, a sitemap should list URLs on the same host where it's published. Cross-site setups need verification of both sites.

Do I need separate image or video sitemaps?

Only for special cases, such as media that isn't discoverable from your pages. Most sites don't need them.

Summary

List canonical, indexable 200 URLs; keep lastmod honest; ignore priority and changefreq; split big sites with an index; and generate it automatically. Then reinforce it with good internal links.

Sources