XML Sitemap for SEO: What It Is and How to Create One
Google finds most pages by following links. But what about a brand-new page that nothing links to yet, or a deep page buried five clicks from your homepage? Google may take weeks to find it — or never find it at all.
That is the problem an XML sitemap solves. It is a simple file that lists the important pages on your site and hands that list directly to Google. No waiting, no guessing, no hoping a crawler stumbles onto the page.
What is an XML sitemap?
An XML sitemap is a file, usually called sitemap.xml, that lives on your website and lists the URLs you want search engines to find and index. Each entry gives the page address, and can also say when the page was last updated and how important it is compared to your other pages.
It is written in XML — the same kind of structured format as an RSS feed — so it is meant for search engines to read, not for people. A visitor will never open your sitemap and read it like a page. Google will.
Think of it as a map you hand to Google at the door, instead of making it wander your whole house looking for rooms.
Why a sitemap matters
A sitemap does three jobs at once:
- It helps Google discover new pages. A new post that has no backlinks and few internal links can still be found quickly, because it is listed in the sitemap.
- It helps Google find hard-to-reach pages. Deep pages, pages in a large catalogue, and pages on a new site with almost no links are all easier to discover through a sitemap.
- It tells Google which pages matter. By listing only your important, indexable pages, you point Google’s attention where it counts — instead of letting it spend time on pages you never wanted indexed.
A sitemap does not guarantee that Google will index a page. It only guarantees that Google knows the page exists. The page still has to be worth indexing. But a page Google never finds can never rank, so discovery is the first step everything else depends on.
What goes in a sitemap — and what does not
A good sitemap lists only pages you want in Google’s index:
- Your homepage and main landing pages
- Blog posts and guides
- Product and category pages
- Any page that should appear in search results
It should never list:
- Pages blocked by robots.txt — listing a page and blocking it at the same time sends Google two opposite instructions
- Pages with a noindex tag — if you told Google not to index a page, do not also invite it to look
- Redirected pages — list the final destination, not the old address
- Duplicate or non-canonical versions of the same page — list the one canonical URL only
- Admin, login, cart, and thank-you pages — these are not search content
A sitemap full of junk pages is worse than a short, clean one. Every bad URL in the file wastes the crawl attention your good pages need.
Sitemap vs sitemap index
A single sitemap file has limits: at most 50,000 URLs and 50MB uncompressed. Most small sites never come close. But a large site — a shop with 80,000 products, a news site with years of archives — will pass that limit.
That is what a sitemap index is for. It is a file that lists your other sitemap files, instead of listing pages directly. For example, an index might point to a posts sitemap, a pages sitemap, and a products sitemap. Google reads the index first, then reads each sitemap it points to.
If your site has only a few hundred pages, one sitemap file is enough. If it has tens of thousands, split it into sections and use an index to tie them together.
How to create a sitemap
There are three common ways, from easiest to most hands-on:
- Let your SEO plugin do it. In WordPress, Rank Math and Yoast generate a sitemap automatically and update it every time you publish or delete a page. This is the right choice for almost everyone — the sitemap stays in step with your site without you touching it.
- Use an online sitemap generator. Paste your homepage address, let the tool crawl your site, and download the finished sitemap.xml file to upload to your server. Useful for sites without a plugin, but you must regenerate it after big changes.
- Write it by hand. Only sensible for a tiny site with a handful of pages that rarely change. One entry per page, inside a urlset block, with a loc tag holding the full URL. One typo can break the whole file — so always validate it before submitting.
Whichever way you create it, check the result before you hand it to Google.
The 3-step check before you submit
- Open it in a browser. Your sitemap should be reachable at yourdomain.com/sitemap.xml and should show raw XML, not an error page or a login screen.
- Validate it. Paste the contents into the free Sitemap Validator (https://blogginginsight.com/sitemap-validator/) and check that the XML is well-formed, the root element is correct, and every entry has a valid loc tag. A single unescaped & in one URL out of thousands can make the whole file unreadable.
- Submit it in Google Search Console. Uploading the file is not enough. Go to Search Console, open the Sitemaps report, and submit the sitemap URL. That is what prompts Google to fetch it, process it, and report any errors back to you.
5 mistakes to avoid
- Listing pages you blocked or noindexed. Mixed signals waste crawl budget and confuse Google about what you actually want indexed.
- Never updating the sitemap. A sitemap that still lists deleted pages — or misses your newest posts — stops being a trustworthy map. If your plugin does not update it automatically, regenerate it after every big change.
- Including every URL on the site. Tag pages, search-result pages, filtered product listings, and duplicates do not belong. A sitemap is a shortlist, not a dump of everything.
- Submitting once and never checking again. Migrations, redesigns, and plugin changes are the moments a sitemap silently breaks. Check the Sitemaps report in Search Console after any of those.
- Forgetting the sitemap exists. A sitemap is not a one-time job. Treat it like any other part of your site: check it every few months, and every time you add or remove a large batch of pages.
Checklist before you publish
- Every important, indexable page is listed — and nothing else is
- Every URL is the full canonical version, starting with https://
- No blocked, noindexed, redirected, or duplicate URLs are included
- The file opens correctly at yourdomain.com/sitemap.xml
- The XML validates with no errors
- The sitemap is submitted in Google Search Console
Try it on your own site
Open your sitemap in a browser right now. Is your newest post in it? Are there old pages in it that no longer exist? Copy the whole file and run it through the free Sitemap Validator (https://blogginginsight.com/sitemap-validator/) — if it passes, submit it in Search Console and let Google do the rest.