Technical SEO

XML Sitemap Best Practices That Actually Help Crawling

XML sitemap best practices come down to one rule: the sitemap must list only canonical, indexable URLs that actually exist, with honest lastmod dates. In my builds at webdev-saif.com I generate sitemaps from the same route registry the app uses, split them into a sitemap index past 50,000 URLs, and ignore priority and changefreq because Google ignores them.

By Saif Al Jahanwebdev-saif.com

What an XML sitemap is actually for

An XML sitemap is a discovery aid, not a ranking signal. It tells crawlers which URLs you consider important and when those URLs last changed, but it does not force indexing or boost position. In my technical SEO work I treat the sitemap as a map of the canonical, indexable surface of a site: one entry per URL that should appear in search, nothing else. Google can find pages through internal links alone, so a sitemap earns its keep on large sites, new sites with few backlinks, and sites with deep or thinly linked archives. The file follows the sitemaps.org protocol, with a urlset root and one url node per page containing a loc and optional lastmod, changefreq and priority children. Everything in it must be publicly reachable over HTTPS and return a 200 response. A sitemap that lists staging hosts, redirect targets or noindex pages wastes crawl budget and sends conflicting signals about what matters.

  • A discovery aid for crawlers, never a direct ranking factor
  • One entry per canonical, indexable URL that returns HTTP 200
  • HTTPS URLs only, matching the canonical host and trailing-slash style
  • Most useful on large, new or weakly linked sites

Keep lastmod honest

The lastmod tag is the part of a sitemap crawlers take most seriously, and the part most often faked. It should state the date a page's main content last changed in a meaningful way, in W3C datetime format such as 2026-11-26 or 2026-11-26T09:30:00+06:00. Do not set it to the build timestamp, the server file mtime, or the current date on every deploy. If a template, footer link or analytics snippet changes, the content has not changed and the date should stay put. In my builds I store an updated_at value on the content record and render lastmod straight from that field, so the sitemap and the schema dateModified agree. Google treats lastmod as a hint, not a promise, and ignores it when it is obviously unreliable. Honest dates help crawlers prioritize recrawling of pages that genuinely changed; inflated dates train them to ignore the tag entirely.

  • W3C datetime format: 2026-11-26 or 2026-11-26T09:30:00+06:00
  • Set it from the content record's updated_at, not the deploy clock
  • Do not bump lastmod for template, navigation or tracking changes
  • Keep lastmod equal to schema.org dateModified on the same page

Use a sitemap index past 50,000 URLs

A single sitemap file is limited to 50,000 URLs and 50 MB uncompressed. Cross either limit and you need a sitemap index: a small XML file that lists other sitemap files through sitemapindex and loc children instead of listing pages directly. I split by content type or section, for example one file for posts, one for pages, one for product URLs, and submit the index as the single URL in Search Console. Google follows the links in the index and crawls each child sitemap. Splitting also helps diagnosis: when one child file returns a parse error, the rest of the site's discovery is unaffected. There is no minimum size, so you can adopt an index early if it matches how your content is organised. Keep child sitemap URLs in the index canonical and HTTPS, and regenerate the index whenever a child file is added or removed.

  • Single sitemap ceiling: 50,000 URLs and 50 MB uncompressed
  • sitemapindex file lists child sitemap URLs; children list page URLs
  • Split by content type or section to isolate failures
  • Submit only the index URL in Google Search Console

Why priority and changefreq are ignored

The priority and changefreq tags are the most common source of wasted effort in sitemap work. Google has stated publicly that it ignores both. Priority runs from 0.0 to 1.0 and changefreq from always to yearly, but neither changes how often a page is crawled or where it ranks. Setting every page to priority 1.0 and changefreq daily does not help and makes the file harder to read. I still include lastmod because it carries real information, and I omit the other two tags unless a client's other search tooling needs them. The practical substitute for priority is internal linking: pages you want crawled more often should sit closer to the home page and be linked from high-traffic templates. That signal is real, measurable and under your control, unlike a tag a crawler discards.

Keep the sitemap in sync with real routes

A sitemap drifts the moment it is maintained by hand. The reliable approach is to generate it from the same route registry or content query that powers the site, so the file cannot list a URL the app no longer serves. In a WordPress build I query only published posts and pages with a self-referencing canonical, exclude anything marked noindex, and write the file to the site root on save or through a scheduled hook. In a Next.js or PHP application I generate sitemap.xml at request time from the route table, which removes the stale-file problem entirely. Every listed URL must return 200, use the canonical host, and match the trailing-slash convention used by canonical tags. Facets, filter permutations, paginated duplicates and parameter variants do not belong in the sitemap.

  • Generate from the route registry or published-content query, never by hand
  • Exclude noindex, redirected, canonicalized and 404 URLs
  • One URL variant only: canonical host, HTTPS, consistent trailing slash
  • Regenerate on publish/delete or render dynamically at request time
  • Leave facets, filters and parameter duplicates out of the file

Submit, monitor and verify coverage

Submit the sitemap URL, or the sitemap index, in Google Search Console and Bing Webmaster Tools, then read the Sitemaps report for errors instead of assuming success. Success means the file was parsed, not that every URL was indexed. The Pages report shows which submitted URLs are indexed, discovered from the sitemap, crawled but not indexed, or excluded, and that gap is where the useful diagnosis lives. A common pattern is a sitemap listing pages that canonicalize elsewhere or carry noindex, which surfaces as excluded. I also fetch the file with curl after each deploy to confirm the content type, the XML declaration and the URL count. Watching crawl stats over a few weeks tells you whether the sitemap is improving discovery or simply echoing what internal links already do.

  • Submit the index URL once in Google Search Console and Bing Webmaster Tools
  • Parsed successfully does not mean indexed
  • Check the Pages report for excluded, canonicalized and noindex URLs
  • curl the sitemap after deploy to confirm headers and URL count

Mistakes I fix in technical SEO audits

Most sitemap problems are mundane. Files generated on a staging domain and copied to production leave staging host URLs in loc tags. Mixed HTTP and HTTPS entries, or both trailing-slash variants of the same page, split signals and waste crawl budget. Some sites list every tag, search result and filter combination, producing a sitemap of thousands of low-value URLs that buries the pages that matter. Others go stale for months after a migration and keep advertising redirected or deleted URLs. I also see lastmod set to today's date on every build, which teaches crawlers to distrust it. The fix is always structural: generate from one canonical source, validate the output against the sitemaps.org schema, and make the sitemap a build artifact nobody edits by hand.

Frequently asked questions

How often should I update my XML sitemap?

Whenever the set of indexable URLs changes, not on a fixed schedule. Publishing, deleting or changing a canonical should update the sitemap immediately; editing a footer or template should not. In my builds I generate the file from the published-content query at request time or on save hooks, so it updates itself. There is no ranking bonus for resubmitting an unchanged sitemap every day.

Does a higher priority value rank a page higher?

No. Google ignores the priority tag, and it does not change crawl frequency or position. Setting every URL to 1.0 achieves nothing. Changefreq is ignored for the same reason. Keep lastmod, which is a useful recrawl hint when accurate, and invest the effort in internal links and unique, matching titles instead. Those are signals you can measure in Search Console; priority is a number in a file a crawler throws away.

Should lastmod be the publish date or the last edit date?

Use the last meaningful content edit date, not the original publish date and not the deploy time. If you revised the body, added sections or corrected a factual error, bump lastmod; if you only changed CSS, navigation or tracking, leave it alone. Store the value in the content record as updated_at and render it into both the sitemap and schema.org dateModified, so the two never disagree. Use W3C datetime format with a timezone offset where possible.

When do I need a sitemap index?

When a single file would exceed 50,000 URLs or 50 MB uncompressed, or when splitting by content type makes maintenance easier. A sitemap index is a small XML file whose sitemap children point to other sitemap files. Submit the index URL in Search Console and Google follows the child files. There is no penalty for using an index early, so teams with separate posts, pages and product archives often adopt one from the start.

Should noindex or canonicalized pages be in the sitemap?

No. A sitemap should contain only canonical, indexable URLs that return 200. Listing a noindex page or a URL that canonicalizes to another address creates conflicting signals and shows up as excluded in Search Console. Filter those URLs out at generation time from the same query that builds the canonical tags. Redirects, 404s, faceted results and parameter variants also stay out. A shorter, accurate sitemap beats a complete-looking one full of pages you do not want indexed.

Written by Saif Al Jahan, webdev-saif.com · Mymensingh, Bangladesh. Last updated .