How to create a sitemap for a website and help search engines find it

How to create a sitemap for a website and help search engines find it

Search engines find pages by following links, so a new page that nothing links to yet can go unnoticed. A sitemap lists your pages for them, and robots.txt tells every crawler where the sitemap is.

What a missing or broken sitemap costs

A page that nothing links to, or one buried several clicks deep, can wait a long time before a crawler reaches it. A sitemap is an XML file that lists the pages you want crawled, each with an optional lastmod date, so search engines don't have to discover them link by link.

It only helps when crawlers can find and read it. The usual mistakes are a sitemap at an address that robots.txt never mentions, one file that mixes URLs from two domains, and changefreq and priority values filled in as if they raised rankings. Google ignores both fields. One file holds at most 50,000 URLs, so a large site needs several files and a sitemap index.

Build the file, link it, then check it

Build the file in the XML Sitemap Generator. Paste a list of absolute URLs, or use collect mode to fetch one page and pull up to 500 of its same-host links. Collect mode reads that one page only, doesn't follow links across the site, and misses links that JavaScript adds later. All URLs must belong to one host. If the file would go over 50,000 URLs or 50 MB, the tool splits it and writes a sitemap index. Upload the result to the root of your site.

Next, tell crawlers where the file is with the Robots.txt Generator. Enter your sitemap URL and it adds a Sitemap: line to the file, next to any Disallow rules for private folders. robots.txt lives at the root of the host, such as https://example.com/robots.txt, and each subdomain needs its own.

Then check the result in the Website Sitemap Extractor. It reads robots.txt, tries /sitemap.xml and four other common paths, and lists every sitemap it finds with its type, URL count, and newest lastmod. A sitemap that returns broken XML stays in the table with the reason in the Error column, so you can see which file needs fixing.

Create a sitemap for your website

  1. Collect the URLs of the pages you want indexed, all on one host.
  2. Paste them into the XML Sitemap Generator, add lastmod if you have accurate dates, and download sitemap.xml.
  3. Upload sitemap.xml to the root of your site.
  4. Add the sitemap URL in the Robots.txt Generator and upload the new robots.txt to the root.
  5. Enter your domain in the Website Sitemap Extractor and confirm the sitemap appears with the right URL count.

What these tools don't do

  • Collect mode reads one page. It isn't a crawler.
  • The extractor only finds a sitemap that is listed in robots.txt or sits at one of the five common paths.
  • robots.txt is a request. Well-behaved crawlers follow it, and scrapers can ignore it.
  • None of the tools submits your sitemap to Google Search Console or Bing Webmaster Tools. Do that in each search engine's own tools.

Frequently asked questions

Where should I put my sitemap?

At the root of your site, such as https://example.com/sitemap.xml, with a Sitemap: line in robots.txt so every crawler finds it.

Should I fill in changefreq and priority?

You can, but Google ignores both. lastmod is the more useful field when it is accurate.

How many URLs can one sitemap hold?

Up to 50,000 URLs or 50 MB. A larger site splits its URLs into several files listed in a sitemap index.

Can one sitemap list URLs from two domains?

No. A sitemap lists URLs from one host. Split mixed domains into separate files.

Tools used in this guide

  • XML Sitemap GeneratorSEO Tools

    Build sitemap.xml files from pasted URLs or collect links from one page and export valid sitemap XML.

  • Robots.txt GeneratorDeveloper Tools

    Creates robots.txt rules for search and AI crawlers and tests URLs against them.

More from the blog

All guides