Blog / Tool Tips & Guides

How to Build an XML Sitemap From Scratch

By Abid · August 21, 2026

A sitemap is an XML file listing the URLs on your site that you want found, with a little information about each. The XML Sitemap Generator builds one from a list of addresses.

What belongs in one

Only URLs you want indexed, and only the canonical version of each. That sounds obvious and is where most sitemaps go wrong.

Leave out: anything noindexed, anything blocked in robots.txt, redirects, pages returning errors, parameter variations, and non-canonical duplicates. Every one of those is a contradiction - you are asking for a page to be indexed while telling the engine elsewhere not to index it, and Search Console reports it as an error.

A sitemap does not guarantee indexing. It is a discovery aid: it says these pages exist and here is when they changed. Pages get indexed on their merits.

The fields, and which are read

loc is the URL, and it is the only required one. It must be the absolute address and it must match your canonical exactly - including the protocol, the www or its absence, and the trailing slash.

lastmod is when the page last changed, and Google does use it - provided it is accurate. A file where every page claims to have changed today is ignored, because that is the signature of a sitemap generated carelessly. This is why it should come from a real modification timestamp rather than from the current date.

changefreq and priority are in the specification and Google ignores both. They were abused into meaninglessness - every page claimed daily and priority 1.0. You can include them; nothing reads them.

The two limits

50,000 URLs and 50 MB uncompressed per file. Beyond either, split into several sitemaps and list them in a sitemap index file, which is itself an XML file listing sitemaps rather than pages.

Large sites often split by type anyway - one for pages, one for posts, one for products - because it makes Search Console's per-sitemap reporting far more useful for finding where a problem is.

Telling Google about it

Two ways, and both are worth doing. Submit it in Search Console, which also gives you the error reporting. And add a Sitemap line to your robots.txt, which any crawler will find without being told.

Resubmitting after a large change is reasonable. Resubmitting daily achieves nothing - crawlers fetch it on their own schedule.

Common questions

Do I need a sitemap?

A small, well-linked site will be found without one. It helps most for large sites, new sites with few links, and pages that are not well linked internally.

Should images and videos be in it?

There are specific extensions for both. Worth it if image or video search matters to you.

Does a sitemap help rankings?

No. It helps discovery, which is a prerequisite rather than a boost.

What about an HTML sitemap page?

A different thing, aimed at visitors. Useful for navigation, not a substitute.

Got a list of URLs to turn into a sitemap?

Generate an XML sitemap