SEO – XML Sitemap
An XML sitemap is a file which lists the important URLs of your website. It helps search engines to find your pages, especially new pages, or pages which have few links pointing to them. It does not guarantee ranking, and it does not guarantee that every page will be indexed, but it helps in discovery.
Example of a sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2026-09-01</lastmod>
</url>
<url>
<loc>https://example.com/seo-introduction/</loc>
<lastmod>2026-08-15</lastmod>
</url>
<url>
<loc>https://example.com/seo-title-tag/</loc>
<lastmod>2026-08-20</lastmod>
</url>
</urlset>
Tags in a sitemap
| Tag | Meaning | Used by Google? |
|---|---|---|
<loc> | The full address of the page (required) | Yes |
<lastmod> | The date of the last real change of the page | Yes, if it is accurate |
<changefreq> | How often the page changes | No, ignored |
<priority> | Importance from 0 to 1 | No, ignored |
Use lastmod only when the page content really changed. If it shows a new date every day for all pages, Google learns not to trust it.
Limits
- One sitemap file can have at most 50,000 URLs and be at most 50 MB when not compressed.
- For a bigger site, make many sitemap files and list them in a sitemap index file.
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://example.com/sitemap-posts.xml</loc>
<lastmod>2026-09-01</lastmod>
</sitemap>
<sitemap>
<loc>https://example.com/sitemap-pages.xml</loc>
<lastmod>2026-08-10</lastmod>
</sitemap>
</sitemapindex>
What to put in a sitemap
- Only pages which you want in the search results: status 200, indexable, and canonical.
- Not the redirected pages, 404 pages, pages with
noindex, or duplicate URLs.
How to create a sitemap
- WordPress: WordPress makes one by itself at
/wp-sitemap.xml. SEO plugins like Yoast SEO and Rank Math make their own, for example/sitemap_index.xml. - Small static sites: use a sitemap generator tool, or write the file by hand like the example above.
- Custom sites: make the file with a script from your database.
Submit your sitemap
- Save the file in the root of your website, for example
https://example.com/sitemap.xml. - Add the line
Sitemap: https://example.com/sitemap.xmlin your robots.txt. - Open Google Search Console, go to Sitemaps, write the sitemap address and press Submit.
- Check the status later. It shows how many URLs were found and if there are errors.
XML sitemap vs HTML sitemap
| XML sitemap | HTML sitemap |
|---|---|
| Made for search engines | Made for visitors |
| A list of URLs in XML format | A normal web page with links |
| Helps discovery of pages | Helps people to find pages, and gives internal links |
| Not seen by visitors | Linked in the footer |
A small site needs only an XML sitemap. A big site can use both.
Note:
Sitemaps are helpful for new sites and big sites. For a small, well linked site, Google can find the pages anyway, but a sitemap is easy to add, so do it. Next: Structured Data.
Congratulations! Chapter Finished. Learn more about the similar topics:
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |