Firm Beacon

How to create an XML sitemap

An XML sitemap lists the page URLs you want search engines to discover. Use your CMS's maintained sitemap if it has one. For a small site with a URL list, generate the XML, publish it on your site and submit its address in Search Console.

Updated 2 October 2026. For website owners and developers in any country.

Choose the right way to create it

Your situationUseCheck first
A CMS or ecommerce platform maintains your pagesIts built-in sitemap or an existing sitemap pluginWhich file is active and how it updates when pages change
A small static site with a curated URL listThe free XML sitemap generatorThat your list contains the public canonical pages you actually want indexed
A large or frequently changing custom siteA sitemap generated from your published-page dataThat unpublished pages and unwanted URL variants are excluded
You do not know which URLs existA CMS export or a crawler with sitemap exportWhether the inventory misses orphan pages or includes filtered and duplicate URLs

A manual file goes stale unless you maintain it. Do not overwrite an automatically updated sitemap with a downloaded list just because the new file looks simpler.

An XML sitemap is for search engines. An HTML sitemap is a page of links for visitors; a visual sitemap is a planning diagram. This guide covers XML, not a replacement for site navigation.

1. Find the existing sitemap

Check your platform's settings and your site's /robots.txt for a Sitemap: line. You can also try /sitemap.xml, but the file may have another name or be a sitemap index that links to several files.

A 404 at that one address does not prove the site has no sitemap. Check the CMS before creating a second system. If the existing sitemap works and stays current, submit that address and review its contents instead.

2. Choose the URLs

Use full absolute URLs, including https:// and the preferred hostname. List the canonical versions you want shown in search results. Review each URL's purpose rather than copying every address from a crawl.

  • Keep public pages that return the intended content.
  • Leave out private account pages, deliberate noindex pages, errors and redirects.
  • Remove tracking parameters and duplicate variants unless a query URL is itself the intended canonical page.
  • Use the site's preferred www or non-www hostname consistently.

The generator checks URL format, not page availability or indexing. Our website audit can inspect up to ten public HTML pages as a separate sample; it is not a complete sitemap validation.

3. Generate the XML

For a curated list, paste one URL per line into the browser-local generator and download sitemap.xml. It removes duplicates and fragments and escapes XML characters. It does not upload your list, crawl your site or add fictional modification dates.

Here is a minimal two-page example. Replace the example addresses with your own URLs.

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

The urlset namespace identifies the sitemap format. Each url contains a loc with the full page address. Query-string ampersands must be XML-escaped: ?a=1&b=2 becomes ?a=1&amp;b=2 in the file.

A single sitemap is limited to 50,000 URLs and 50 MB uncompressed. If either limit is exceeded, split it into files. A sitemap index can list those files. The manual generator produces one file, not an index.

Google ignores priority and changefreq. Include lastmod only when you can supply the actual significant update date of that page. Do not set every page's modification date to today whenever you generate the file.

4. Publish and submit it

  1. Upload the file through your site's normal deployment or CMS process. The site root, such as https://example.com/sitemap.xml, is the usual location.
  2. Open the public address. Confirm it returns the XML, not a login page, error document or firewall challenge.
  3. In a Search Console property you manage, open the Sitemaps report and submit the sitemap address.
  4. Optionally declare the address in robots.txt so crawlers can discover it there too.
Sitemap: https://example.com/sitemap.xml

Downloading the file does not publish it. Search Console also does not upload it to your website; the file must already be publicly accessible. Submission is a hint, not a guarantee that Google will fetch it or index its URLs.

5. Check errors and keep it current

What you seeWhat to check
Could not fetch the sitemapThe exact submitted address, HTTP response, authentication and CDN or firewall rules
An XML parsing errorThe namespace, closed tags, UTF-8 encoding and escaped characters such as ampersands
The sitemap is readable but a page is not indexedThat page in URL Inspection: access, noindex, Google's selected canonical and the reported indexing reason
Removed or redirected pages remain in the fileThe CMS configuration, source URL list or process that regenerates the sitemap

A successful sitemap fetch is not the same as successful page indexing. A sitemap also does not override robots.txt or noindex, fix weak content, or guarantee rankings and AI citations.

When you add, remove or substantially update pages, update the sitemap through the same process. Keep ordinary internal links to important pages; the sitemap should support discovery rather than be the only route to your content.

Sources