Generate Sitemap: How to Create a Website XML Sitemap

Islom BaimatovIslom BaimatovSeptember 7, 202610 min readUpdated September 1, 2026
Generate Sitemap: How to Create a Website XML Sitemap

Short answer

The safest way to generate a sitemap is to let your website platform or SEO plugin create a dynamic XML sitemap that includes only canonical, indexable URLs. After creating it, validate the file, reference it in robots.txt, submit it in Google Search Console, and review it whenever your site structure changes.

A sitemap should be treated as a controlled inventory of URLs—not a machine-generated dump of everything your site can expose. Generate one from your CMS, SEO plugin, crawler, or publishing database, then compare its contents with the pages you actually want search engines and AI systems to find, interpret, and cite. Every listed URL should be canonical, indexable, accessible, and useful as a standalone destination.

The distinction that matters is between discovery and eligibility. A sitemap can point crawlers toward an important page, but it cannot make a weak, duplicated, blocked, or non-canonical page worth indexing. It also cannot guarantee that a search engine or an AI answer engine will select the page as a source. Your sitemap is therefore a quality-control artifact: discrepancies between the URL list, canonical tags, internal links, and live responses often reveal problems before they become visible in traffic or brand mentions.

What is a sitemap for a website?

A website sitemap is usually an XML document containing the canonical URLs you want search engines to discover. It may include a `lastmod` value describing a meaningful content change, but that field is useful only when it reflects the page rather than the time a deployment regenerated the file.

The practical job of a sitemap is to make important pages findable when normal navigation is an imperfect guide—for example, newly published pages, deeply nested documentation, frequently changing catalogs, or large sites with separate product, editorial, and support areas. It is not a substitute for internal links. Search systems need page context, relationships, and accessible content; an isolated URL in XML provides very little of that context.

This matters for AI-search visibility as well. A sitemap can expose a page that an answer engine might otherwise miss, but it does not explain what the page means, which entity it belongs to, or why it should be trusted over another source. Clear page content, descriptive internal links, consistent canonical URLs, and an accessible site structure still do that work. Use the sitemap to make the intended source set explicit, not to compensate for unclear information architecture.

If a URL is blocked, marked `noindex`, redirected, duplicated, or permanently removed, putting it in the sitemap creates competing instructions. Those conflicts are more actionable than the existence of the XML file itself.

How do I create a sitemap?

Start by checking whether your website software already produces a sitemap. A native, automatically updated sitemap is usually safer than a static export that becomes inaccurate after the next publishing change. Then choose the generation method according to how canonical URLs are managed:

Website situationRecommended way to create a sitemapMain check after creation
WordPress or another CMS with SEO toolingEnable the platform or SEO plugin sitemapConfirm excluded content is intentional
Custom website or web applicationGenerate the sitemap from the database or URL inventoryKeep it synchronized with published pages
Small static websiteCreate an XML file with a trusted generator or scriptRe-run it after URL changes
Large websiteUse a sitemap index with separate sitemap filesCheck coverage, limits, and update logic
Temporary audit or migrationCrawl the site and export discovered URLsRemove test and non-canonical URLs before publishing

Google’s Build and Submit a Sitemap documentation explains supported formats and submission methods. The more important operational question is whether your generation process has an owner and a trigger: what event updates the file when a page is published, redirected, merged, or deleted?

For sites that want visibility in search and AI-driven discovery, retain the source data behind the sitemap. A URL list without publication status, canonical target, language or region, and last meaningful update is difficult to audit when a page disappears or changes purpose.

How can I create a free sitemap?

You can create a free sitemap with your CMS, an SEO plugin, a script, or an online XML sitemap generator. The cost is not the quality test. The quality test is whether the output reflects the pages your organization wants discovered and whether it can be regenerated after URL changes.

Use this free workflow:

  1. Identify the canonical domain and preferred protocol.
  2. Export published URLs from the CMS or database, then crawl the live site to find discoverable URLs that the export may miss.
  3. Label redirects, errors, duplicates, parameter variants, blocked pages, `noindex` pages, and pages with a different canonical target.
  4. Remove those conflicts from the final URL set instead of merely hiding them from the report.
  5. Build the XML file and publish it at a stable location such as `/sitemap.xml`.
  6. Test XML parsing, URL responses, canonical alignment, and representative page content.
  7. Reference the file in `robots.txt` and submit it through the relevant webmaster tools.

For a quick crawl-based option, XML Sitemaps Generator is one available online generator. Treat its export as an inventory, not as editorial judgment. A crawler can discover faceted URLs, thin utility pages, or old paths that your publishing system no longer considers part of the site.

How do I make sitemap XML correctly?

Create a UTF-8 XML document using the sitemap namespace, with one `<url>` element for each eligible absolute URL. Formatting errors are easy to detect; incorrect membership is the harder problem. Optional fields should come from real page data, not default values copied across the entire site.

A minimal XML sitemap looks like this:

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

Use one hostname and protocol convention, escape special characters according to XML rules, and use the canonical URL in `<loc>`. The `<lastmod>` value should describe a meaningful page change—not a routine sitemap rebuild. Changing every date on every deployment can make the signal less credible. The older `<changefreq>` and `<priority>` fields cannot compensate for poor internal linking or an inaccurate URL set.

For AI-search visibility, do not interpret inclusion as proof that a page is a suitable answer source. A page may be crawlable yet too vague, duplicative, or poorly organized to be selected in an answer. The sitemap should include the definitive version of a topic, while the page itself should make its claims, scope, and update history understandable.

Which URLs should you include?

Include canonical, indexable, useful URLs that you want discovered. Exclude redirects, blocked resources, soft-deleted pages, duplicate variants, internal search results, tracking-parameter URLs, staging pages, and URLs carrying a `noindex` directive.

Use this pre-publication checklist:

  • Does the URL use the preferred HTTPS version?
  • Does it resolve on the canonical hostname?
  • Does it return the expected successful response?
  • Is it free of accidental tracking parameters?
  • Is it internally linked or otherwise intentionally discoverable?
  • Does the page have a clear reason to be indexed or cited?
  • Does the canonical tag point to the same URL?
  • Is the URL absent from `noindex` or access-restriction rules?
  • If it replaces an older page, has the old URL been redirected or removed from the sitemap?

A sitemap can expose technical inconsistency faster than a browser review. A site may show a page to users while its canonical points elsewhere, or may continue listing a URL after a migration. These conflicts can fragment discovery and make it harder for systems—search engines or AI retrieval systems—to identify the authoritative version.

Can a sitemap generator create sitemap XML for every website?

A generator can produce XML for most publicly crawlable websites, but it cannot reliably infer your intended indexable set in every situation. JavaScript applications, login-gated content, faceted navigation, infinite URL patterns, international versions, and large databases require configuration or source-data generation.

A crawler reports what it can fetch. It may miss unlinked pages, misunderstand client-side navigation, or include URLs that should never be indexed. For a custom or large site, generate the sitemap from the same database or publishing workflow that determines which pages are canonical and live. That makes deletion and migration behavior testable rather than dependent on a periodic crawl.

If you use separate image, video, or news sitemaps, create them only when the content type and visibility objective justify them. Keep the architecture legible: a sitemap index can point to files for products, articles, documentation, or regional sections. Record which system owns each file so a future redesign does not leave one section stale.

Is a sitemap generator free to use?

Many generators have free options, and a CMS may create a sitemap without a separate fee. Whether that option is sufficient depends on URL volume, update frequency, filtering controls, export limits, and the ability to validate changes automatically.

The relevant cost is maintenance, not the subscription price. A free tool that repeatedly publishes redirected or non-canonical URLs can create remediation work. Before choosing one, compare its URL source, exclusion rules, regeneration trigger, sitemap-index support, and validation process.

Do not confuse a visual sitemap tool with an XML sitemap generator. A visual sitemap helps people plan information architecture and user flows; an XML sitemap identifies URLs for crawler discovery. The former can improve the relationships and navigation that make pages understandable. The latter cannot create those relationships.

How do you validate and submit a sitemap?

Validate in three layers:

  1. File validity: confirm that the XML parses and uses the expected namespace and structure.
  2. URL validity: check status codes, canonical targets, indexability, access rules, and representative content.
  3. Processing: submit the file through webmaster tools and monitor reported errors and coverage over time.

Publish it at a stable URL and add a line such as this to `robots.txt`:

```text Sitemap: https://www.example.com/sitemap.xml ```

Submission is a reference, not an indexing command. It does not make every URL indexable, rankable, or suitable for inclusion in an AI-generated answer. When validating high-value pages, compare the sitemap entry with the live canonical tag, internal links, rendered content, and the page’s ability to answer a distinct question without relying on duplicate boilerplate.

Review the file after redesigns, domain migrations, taxonomy changes, major imports, and deletion campaigns. A sitemap that was accurate last quarter can become misleading after one release if URL rules changed.

What common sitemap mistakes waste crawl attention?

The most common mistake is treating the sitemap as a complete URL dump. Other recurring failures include listing redirects, including pages blocked by `robots.txt`, using non-canonical versions, setting every `<lastmod>` date to the current date, and publishing a file that the CMS no longer updates.

Another mistake is expecting XML to repair weak information architecture. If important pages have no internal links, are buried behind filters, or are generated only after user interaction, listing them may not solve discovery. It also does not give an AI system enough context to distinguish an authoritative page from a near-duplicate. Pair the sitemap with crawlable navigation, contextual internal links, and pages with clearly differentiated purposes.

SeoVision’s audit corpus shows why the sitemap belongs inside a broader technical review. Across 1,476 websites audited by SeoVision as of 2026-09-01, the median overall SEO score was 76/100, while the median Technical SEO score was 89/100. These figures do not identify sitemap errors or establish causation. They do support a narrower editorial point: a technically healthy site can still require separate checks of URL selection, canonical consistency, content usefulness, and visibility in emerging AI search surfaces.

What the data does not prove

SeoVision’s audit data describes the websites in its own corpus, not every website on the internet. The median scores do not establish that sitemap quality caused any particular SEO outcome, and they do not show whether a site had a valid, invalid, complete, or incomplete sitemap.

The data also does not prove that adding a sitemap will increase rankings, indexing, citations, or AI-search visibility for every site. Results can differ because of content quality, internal links, server behavior, duplication, demand, site history, and search-system decisions. To test impact, establish a before-and-after record of sitemap errors, eligible URLs, discovered URLs, indexed URLs, and—where relevant—whether priority pages appear in brand or AI-visibility monitoring. Do not treat a single reading as a trend.

What to do next

  1. Find the current sitemap. Check your CMS, SEO plugin, and `robots.txt` for an existing sitemap or sitemap index before creating another file.
  2. Export the URL set. Combine published URLs with a live crawl. Mark each URL as canonical, indexable, redirected, blocked, duplicate, `noindex`, or unnecessary.
  3. Remove conflicting URLs. Exclude redirects, errors, parameter duplicates, staging pages, `noindex` URLs, and pages whose canonical points elsewhere.
  4. Generate the XML. Use the CMS, a controlled script, or a generator. Keep the file at a stable public URL and use accurate `<lastmod>` values only for meaningful changes.
  5. Run technical checks. Test XML parsing, HTTPS consistency, canonical alignment, response status, `robots.txt` access, and representative page content.
  6. Submit and document it. Reference the sitemap in `robots.txt`, submit it in webmaster tools, and record the submission date and file location.
  7. Schedule a maintenance review. Recheck the sitemap after migrations, redesigns, major publishing events, and URL removals. Connect the review to your broader SEO audit workflow.
  8. Measure the right outcome. Track sitemap processing, eligible URLs, indexing coverage, and the discoverability of priority pages over time. If AI visibility matters to acquisition, also review how those pages support brand tracking and AI mention monitoring.

How we measured

The cited figures come from SeoVision’s audit corpus of real websites, covering 1,476 websites audited as of 2026-09-01. The corpus reports a median SEO score of 76/100 and a median Technical SEO score of 89/100. One limitation is that this is SeoVision’s own audit corpus, so it should not be treated as a random sample of all websites.

FAQ

How can I create a free sitemap?

Use your CMS or SEO plugin if it generates an XML sitemap automatically. You can also crawl a small public website with a free generator, remove redirects and non-indexable URLs, publish the XML file, and submit it through webmaster tools.

Which sitemap generator is best?

The best sitemap generator is usually the one that stays synchronized with your website and lets you exclude redirects, duplicates, blocked URLs, and noindex pages. Native CMS generation is often preferable; crawler-based tools are useful for audits, migrations, and smaller static sites.

Is a sitemap generator free to use?

Many sitemap generators and CMS plugins have free options. Check whether the free version supports your site’s URL coverage, filtering, validation, and update requirements before relying on it.

What is a sitemap for a website?

A sitemap is a file that helps search engines discover the important URLs on a website. It supports crawling but does not guarantee that listed pages will be indexed or rank.

How do I create a sitemap XML?

Create a UTF-8 XML file with the sitemap namespace and one `<loc>` entry for each canonical, indexable URL. Publish it at a stable address such as `/sitemap.xml`, validate it, reference it in `robots.txt`, and submit it through webmaster tools.

Sources

  1. Build and Submit a Sitemap | Google Search Central
  2. XML Sitemaps Generator: Create your Google Sitemap Online

Reference: SEO & AI-search glossary · AI visibility tools compared · tool alternatives

Make SeoVision a preferred source

One tap and Google shows our articles more often in your Top Stories, Discover and AI answers. It only changes what you see, and you can undo it any time.

See if AI is citing your brand

Track how ChatGPT, Claude, Gemini and Perplexity talk about you — and get cited more.

Get started for free