Understand the idea
A sitemap is a machine-readable list of URLs you want search engines to discover. It complements links between pages; it does not replace useful navigation or promise indexing.
Start with a small list of public, preferred page addresses. The example below describes a fictional site with three pages. Replace both the domain and the paths with your own real URLs before publishing it.
Read the example
An original minimal template. The example.com addresses are placeholders. No dates are invented and no optional ranking hints are needed.
<?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>
<url><loc>https://example.com/notes/</loc></url>
</urlset>Read the structure
urlsetwraps the list. Its namespace identifies the sitemap vocabulary. Keep that namespace exactly as shown, including its http scheme; it is an identifier, not an insecure asset request.- Each
urlgroups the information about one page. locsupplies the complete page address, including scheme and host. A relative path such as /about/ is not enough here.
Choose the entries before writing XML
Use the preferred versions of public pages intended for search. Avoid redirecting aliases, missing pages, duplicates and pages marked noindex. A sitemap is public: do not put private or token-bearing URLs in it. Omitting a URL from a sitemap does not make the page private.
Dates should mean something
The optional lastmod value describes the page’s actual modification, not the time a generator ran. If you cannot maintain a trustworthy date, omit it. Google ignores priority and changefreq; adding them is not a shortcut to better rankings.
XML characters need care
An ampersand in a URL must be written as & inside XML. The resulting address still contains an ampersand when parsed. Do not confuse XML escaping with URL percent-encoding: they solve different problems.
Save, publish and inspect
- Save the text as UTF-8 in a file named sitemap.xml, without an extra .txt extension.
- Put it in the published site root for this simple setup.
- Open its deployed address and check that it returns XML rather than an HTML fallback or an error.
- Add a discovery line to robots.txt, such as
Sitemap: https://example.com/sitemap.xml, using your real domain. - Optionally submit it through the search engine’s webmaster tools. Submission does not guarantee indexing.
A single sitemap is limited to 50,000 URLs and 50 MB uncompressed. Those protocol limits are separate from a particular generator’s crawl limit. Larger sites need multiple files and a sitemap index.
Keep it in step with your site
When URLs are added, removed or changed, update the list. HTML code FYI builds its own sitemap from its generated page list, so these new lessons join it during the build. If your CMS or build already creates a reliable sitemap, avoid maintaining an unrelated second copy by hand.
Download the placeholder XML template · Generate a sitemap, then check it · Practise finding three sitemap mistakes.
A small mistake, explained
What goes wrong
Copying a template unchanged leaves somebody else’s domain, nonexistent paths or a mix of different site addresses in the sitemap.
How to fix it. Compare every entry with the URL you actually want visitors and crawlers to use. For this ordinary single-site sitemap, keep the same host and consistent HTTPS addresses. Remove duplicates and replace placeholders.
Try it yourself
Write three real public URLs for a site you own. Explain each XML element, then compare your list with the pages you intend to expose. Use the practice exercise before publishing.
Further reading
Sitemaps.org: XML protocol (new tab)
Google Search Central: Build and submit a sitemap (new tab)
Keep exploring
- SEO · Guide
Readable HTML for crawlersMake useful content available before any script runs.
- SEO · Guide
Generate it. Then check it.Use sitemap.download as a starting point, review what it found and publish the result.