Define inclusion rules before writing XML

Create an updating map of canonical pages

Do not copy every discovered URL into the sitemap. List page types, exclude redirects, errors, noindex and non-canonical addresses, configure a generator and test updates with a new or changed page.

Sitemap creation process: URL rules, XML generator, validation and submission
Rules → generator → validation → declaration and submission.

Message for a developer or support team

“Configure a dynamic sitemap for canonical indexable URLs returning 200. Exclude noindex, redirects, errors, service pages and parameter duplicates. Use absolute HTTPS URLs and accurate lastmod only; omit meaningless priority and changefreq. Split at protocol limits, declare the index in robots.txt and demonstrate adding and removing a page.”

What to prepare

  • a backup of current files and generator configuration;
  • public page types and canonical rules;
  • published, removed, noindex and redirected examples;
  • CMS, server and Search Console access when needed.

Step-by-step configuration

  1. Open current sitemaps and robots.txt; save files, responses and URL counts.
  2. For each content type approve: published, self-canonical, indexable and 200.
  3. Enable the CMS generator or build a maintainable script; reserve manual XML for a stable small site.
  4. Generate absolute URLs on one canonical protocol and host, escaping special characters.
  5. Add lastmod only from significant page-update dates.
  6. At 50,000 URLs or 50MB uncompressed XML, split files and create a sitemap index.
  7. Validate XML and sampled URLs, add Sitemap: to robots.txt and submit the index in Search Console.
  8. Publish, update and remove a test page and verify corresponding sitemap changes.

Minimal XML

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page/</loc>
    <lastmod>2026-07-17</lastmod>
  </url>
</urlset>

Google ignores priority and changefreq and uses lastmod only when consistently accurate. See Google's official guidance.

Risks, rollback and separate work

An overly broad rule can expose service URLs, while a narrow rule can omit new page types. On failure, restore generator configuration and the prior file, then repeat sampling. Never place secret URLs in a sitemap; it is public.

Use the verification guide afterwards. Hreflang, image/video/news extensions, URL repairs and a full indexation audit are separate. For a complex CMS, order configuration.