XML sitemap best practices start with a simple question: does this file describe the public pages you actually want people to find? A file can open without errors and still list old addresses, duplicate versions or unpublished content.

For a small blog, the useful routine is to generate the sitemap from published content, check its URLs against the live site, and keep its modification dates honest. This guide walks through that routine with a minimal XML example and an illustrative URL inventory.

What is an XML sitemap?

An XML sitemap is a machine-readable file containing page addresses and, optionally, information such as when those pages changed. It helps a search engine discover content. It does not tell the search engine that every listed page deserves to be indexed. You can also compare sitemap URLs with your internal links to investigate orphan-page candidates.

An HTML sitemap is different: it is a navigable page intended for people. A sitemap index is different again: it points to sitemap files rather than listing all the individual pages itself.

Google's sitemap introduction explains that a small site with comprehensive internal links may not need a sitemap, although one can still help discovery. A sitemap does not guarantee crawling or indexing.

For the next step after preparing the file, see **how to submit a website to search engines**.

Start by checking the site's existing setup. Open its public sitemap address, inspect the site's robots.txt for a Sitemap declaration, or check the CMS settings. The address might be /sitemap.xml or an index with a different filename. Avoid creating a second competing generator before understanding the first one.

If the browser displays XML with a message about missing style information, that message alone is not an error. XML can be valid without a visual stylesheet. What matters is the file's contents and whether the intended crawler can retrieve and process it.

XML sitemap best practices: choose the right URLs

Treat the sitemap as a maintained inventory of preferred public addresses. Before adding a URL, establish its purpose, final destination and indexability. A successful response is one useful check; it does not establish that the page contains worthwhile content or should appear in search.

For an ordinary blog article, the preferred candidate is a published page that loads directly, allows indexing, has a consistent canonical address and is useful to readers. If the URL has moved, inspect the destination instead of keeping the old address in the file.

Three checks for a sitemap candidate: published purpose, direct accessible page and consistent preferred address
Original review diagram: resolve each candidate's purpose, response and preferred address before adding it to the sitemap.

Use the following fictional inventory as a decision exercise. These are illustrative addresses and outcomes, not an audit of a real website.

Candidate address on example.comObserved conditionSitemap decision
/blog/technical-checklistPublished, direct 200 response, preferred addressInclude the full preferred URL
/blog/old-checklistPermanently redirects to the checklistUse the final checklist URL instead
/blog/draft-previewPrivate draft or deliberately noindexExclude from the public sitemap
/blog/technical-checklist?utm_source=emailTracking version of the same articlePrefer the clean canonical address
/blog/deleted-postReturns a genuine 404Remove the obsolete entry
/blog/unlinked-guideUseful published article, no incoming internal linkReview and add a relevant internal link; do not rely only on the sitemap

Parameters are not automatically a reason for exclusion. A parameter may identify a genuinely distinct, useful page. The decision depends on what the address represents and which version should be indexed.

When versions disagree, check the preferred canonical URL before editing the sitemap. Investigate the live canonical element, redirects and the address used in internal links together. A sitemap should reinforce that decision rather than introduce another version.

An orphan article is also a navigation problem. Removing its sitemap entry does not repair the missing path for readers. First decide whether the article should remain public, then connect it from an appropriate topic page or relevant existing article.

How to create an XML sitemap

Choose a method that stays accurate when content changes. A file that is easy to create once but frequently forgotten is a poor fit for a regularly updated blog.

Use the existing publishing system first

Check whether the CMS, framework or SEO plugin already generates the file. Review its published-content rules and exclusions. Then test what happens when an article becomes public, changes address or is removed.

For a static site, a build step can generate the sitemap from the same published-post collection that creates the blog listing. Keep drafts out of that collection. Store each article's meaningful modification date separately from the build date.

Choose a generator when the site needs one

If there is no maintained output, decide how generation will work before choosing a tool. A crawler-based generator can only discover the pages it can reach, so compare its output with the publishing inventory.

MethodUseful situationCheck before relying on it
CMS or plugin outputArticles are managed in a CMSDraft, noindex and canonical handling
Build-generated XMLA static site already has a published content listCorrect origin, exclusions and per-page modification dates
Crawler-based generatorReviewing a site without a reliable content inventoryMissing unlinked pages and unwanted URL variants
Hand-maintained XMLA tiny site with rare changesA named owner and a reliable update routine

The generator's job is to produce the inventory. The editorial and technical checks decide what belongs in it. Avoid assuming that every address found by a crawler should become a sitemap entry.

Start with a minimal XML sitemap example

This fictional example contains two published addresses. Replace the example origin and dates with verified values for the actual site.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-11-02</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/blog/technical-checklist</loc>
    <lastmod>2026-11-06</lastmod>
  </url>
</urlset>

The sitemap protocol defines the enclosing urlset, one url entry per page and its loc address. Additional fields are optional. XML values require appropriate escaping, such as &amp; for an ampersand in a URL.

Use a proper XML serializer where possible. It is safer than assembling entries by joining unescaped strings. After generation, parse the resulting file and inspect a few complete entries, including any addresses with special characters.

Set lastmod accurately and understand changefreq

The lastmod value describes the linked page's modification date. It should not automatically become today's date because the deployment pipeline rebuilt every file.

Imagine a guide published on 2 November. On 6 November, its author replaces an outdated explanation and adds a new worked example. On 7 November, the site deploys a change elsewhere. The guide's meaningful revision remains 6 November; the unrelated deployment does not make it newly revised.

Bing's explanation of lastmod describes its use in crawl scheduling and warns about consistently replacing modification dates with generation dates. Preserve dates the publishing system can substantiate.

A fictional page keeps its 6 November modification date when an unrelated site build runs on 7 November
Illustrative maintenance example: a substantive page revision and an unrelated rebuild are separate events.

A practical approach is to record why an article's modification date changed. For example: “corrected the XML example and replaced the validation instructions.” This gives the editor a reason to update the visible revision date and the stored modification date together.

What about sitemaps changefreq and priority? These optional protocol fields sometimes appear in generated files, but Google ignores both. Setting every page to daily or giving it a priority of 1.0 does not instruct Google to crawl or rank it more highly.

Validate the file and the pages separately

Use two passes. First confirm that the sitemap can be read as a file. Then confirm that the addresses inside it describe the intended public content.

Pass one: file checks

  • Retrieve the exact sitemap address without signing in. Check for an error response, a redirect to a login screen or an HTML error page disguised as a successful response.
  • Parse the XML and check its namespace, nesting and complete entries. A browser view is useful, but it is not a complete validator.
  • Confirm that entries use full addresses with the intended HTTPS host.
  • Check size before the file becomes large. A single sitemap is limited to 50,000 URLs or 50 MB uncompressed; split it when needed.

Google's sitemap construction guidance covers these format, address and size requirements, along with canonical selection and supported optional fields. For a small blog, a root-level sitemap is usually a straightforward arrangement.

Pass two: content checks

Compare the file with the current published article list. On a small site, review every entry. On a larger site, use automated checks and inspect representative examples from each content type.

Check the final response, actual content, indexability and preferred address. Look for missing new articles, obsolete entries, drafts and alternate versions. Confirm that valuable articles also have useful incoming internal links.

For each discrepancy, record the expected URL, observed condition, owner and next action. “Old slug remains after a redirect” is a testable issue. “Google dislikes the sitemap” is too vague to guide a fix.

Add these checks to the on-page SEO publication checklist so sitemap maintenance happens alongside the article's access, metadata and navigation review.

Read sitemap reports without confusing discovery and indexing

An existing Search Console sitemap report can tell you whether Google retrieved and processed a file, when it was read and whether parsing errors were recorded. Google's Sitemaps report documentation explains the reported statuses and error details.

A Success status does not mean every listed article is indexed. Likewise, an entry count is not a count of ranking pages or search visits. Keep file retrieval, URL discovery, crawling, indexing and search performance as separate observations.

If a useful article appears in the file but remains unindexed, inspect the individual URL and its recorded reason. Compare the report's date with the date of your fix. An older report cannot demonstrate that a recent change failed.

Use the guide to diagnose a discovered URL that is not indexed for the next investigation. Repeatedly editing a healthy sitemap does not explain why a particular page has not been selected for indexing.

Do you need other sitemap types?

Keep the output proportionate to the content. A small text-led blog usually starts with one ordinary page sitemap. An index becomes useful when it groups multiple sitemap files, such as different sections or files that exceed the limits.

Image, video and news information can use supported sitemap extensions where the site has the relevant content and requirements. Localized page versions can also have language annotations. These need their own accurate implementation; adding a label called “multilingual sitemap” is not enough.

Do not create extra sitemap types simply because a larger publisher has them. Identify the discovery or maintenance need first, then check the applicable extension documentation before changing the output.

XML sitemap best practices for ongoing maintenance

Use a short change-triggered routine rather than waiting for an indexing complaint.

  • After publication, confirm the final article address appears and its draft preview does not.
  • After a substantial revision, check the recorded lastmod and the article's visible update information.
  • After a move or deletion, check the old entry and the replacement or removal decision.
  • After changing a generator or publishing platform, compare the full URL inventory before and after.
  • During periodic review, separate file errors from individual-page indexing statuses and search performance.

For a small blog, a simple review log can contain the check date, sitemap address, article address, observed result and follow-up. This makes the next investigation faster because the editor can distinguish what changed from what was already working.

Frequently asked questions

Can an XML sitemap improve SEO by itself?

It can support discovery and maintain a clearer inventory of preferred pages. It does not replace relevant content, usable navigation or technical access, and it does not guarantee a search ranking.

Should every website URL be in the sitemap?

No. Build the list around the public addresses you want indexed. Review drafts, deliberately noindex pages, obsolete addresses and duplicate versions instead of exporting every URL the system can produce.

Why is an article missing from an automatically generated sitemap?

Check its publication status, generator filters, URL type and build output. Compare it with a similar included article. A missing entry could be a configuration issue, while a deliberately private draft may be correctly excluded.

Is lastmod required?

It is optional. When included, use a date supported by the page's actual modification history. A missing optional value is preferable to a fabricated revision date.

Do I need to regenerate the file manually after every article?

That depends on the publishing setup. A reliable CMS or build process can maintain it automatically. Verify that behaviour once, then recheck after changes to publishing rules rather than maintaining an unnecessary second file.