How to Make a Sitemap (Any Site, Any CMS)

How to make a sitemap: a minimal XML file to copy, what to list and what to leave out, and exact steps for WordPress, Shopify, Wix, Next.js and any other site.

How to Make a Sitemap (Any Site, Any CMS)

Here is how to make a sitemap: list every page you want in search results as a full URL in an XML file, save it as sitemap.xml in UTF-8, upload it to the root of your site and add a Sitemap: line to your robots.txt. Each URL should be the canonical version of a page that answers 200. Often you do not have to write the file at all: WordPress, Shopify, Wix and Squarespace create one automatically, Next.js and static site generators build one from your content with a short file or a plugin, and a free crawler can make one for any other site.

This guide covers each of those routes, what to leave out of the file, Google's limits and lastmod rules, and what we found in the sitemaps of 1,513 real sites. For what a sitemap does and whether you need one, see what a sitemap is and how search engines use it. If you meant a visual sitemap for planning a site, or an HTML sitemap page for visitors, those get a short section of their own below.

How do I create a sitemap? Pick the method that fits your site

The fastest way to create a sitemap depends on what your site runs on. Find your row, then go to its section below.

Your siteHow to make the sitemap
WordPressBuilt in since WordPress 5.5, or the sitemap of Yoast SEO or Rank Math
Shopify, Wix, SquarespaceAutomatic. There is nothing to build, only pages to keep out
Next.js (App Router)An app/sitemap.ts file that returns your URLs
Hugo, Jekyll, Astro, GatsbyThe built-in template (Hugo) or the official plugin
Hand-coded or small custom siteWrite the file by hand, or crawl the site with a free sitemap generator
Large custom site or storeGenerate the files from your database when you publish, split over several sitemaps and a sitemap index

How to make a visual or HTML sitemap

To make a visual sitemap, list every page the site will have, put each one under its parent and draw the tree on paper or in a diagramming tool. It is a plan for you and your designers, not a file for search engines. To make an HTML sitemap, publish a page that links to your main sections and pages, and link to it from your footer.

Neither replaces the XML file search engines read. Images, videos, news articles and language versions can go into that file as extra tags, and however you make it, the same rules decide what belongs in it.

How to create a sitemap XML file by hand

To create a sitemap XML file by hand, write one url entry per page inside a urlset element, with the page's full address in loc and, optionally, the date it last changed in lastmod. This is a complete, valid sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2026-11-02</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/services/</loc>
    <lastmod>2026-10-14</lastmod>
  </url>
  <url>
    <loc>https://www.example.com/blog/first-post/</loc>
  </url>
</urlset>
  1. List your URLs. Every page you want in search, written exactly as your canonical tags write it: https://, www or not, trailing slash or not.
  2. Write the file in a plain text editor, not a word processor. Leave lastmod out rather than guess a date.
  3. Save it as UTF-8, named sitemap.xml. Google requires UTF-8.
  4. Escape special characters. Write an & in a URL as &amp; (', ", < and > have escape codes too). One bare ampersand makes the whole file invalid.
  5. Upload it to the root of your site, so it loads at https://www.example.com/sitemap.xml.

The rules for what goes inside come from Google's guide to building a sitemap and the sitemaps protocol:

  • Absolute URLs only. https://www.example.com/pricing, never /pricing. Google crawls the URLs exactly as listed.
  • One host per file. A sitemap on www.example.com lists only www.example.com URLs; shop.example.com needs its own.
  • Scope follows the folder. A sitemap covers only URLs in its own directory and below, so a file at /blog/sitemap.xml cannot list /pricing. Google relaxes both rules for a sitemap you submit in Search Console, as long as you have verified every site it lists. Still, the root covers everything, and it is where Google recommends putting the file.

A plain text file with one URL per line also works, but it cannot carry lastmod, so XML is the better default.

How to choose the URLs your sitemap lists

List a URL only if it answers 200, is its own canonical, allows indexing and is not blocked by robots.txt: Google asks for the URLs you want to see in its search results, and nothing else. Our guide to what a sitemap should include and leave out explains why each kind of URL stays out. When you build the file, the practical question is what to write in its place:

If the URLList instead
RedirectsThe final URL the redirect points to
Returns 404 or 410Nothing. Remove the URL
Carries a noindex tag or headerNothing, or remove the noindex if it is a mistake
Has a canonical tag pointing to another URLThe canonical URL
Is a parameter, sort, filter, print or session version of a pageThe clean URL, once
Is the http, www or non-www, or trailing-slash twin of a pageThe single version your canonical tags use
Is blocked by robots.txtNothing, or unblock it if it belongs in search
Is a login, account, cart, checkout or internal search pageNothing

One fact explains most of the table. A sitemap is a canonical signal: Google's canonicalization guide treats every listed URL as a suggested canonical and asks you not to list one URL while the page's canonical tag names another.

How to make a sitemap in WordPress

WordPress has made a sitemap on its own since version 5.5. Open yourdomain.com/wp-sitemap.xml: it is a sitemap index with sitemaps for every public post type and taxonomy plus your author archives, up to 2,000 URLs per file, and WordPress lists it in the robots.txt it serves (WordPress announcement). If the file is missing, check Settings, Reading: when Discourage search engines from indexing this site is ticked, WordPress turns the sitemap off. And if Settings, Permalinks is set to Plain, the sitemap lives at /?sitemap=index instead.

With an SEO plugin, use the plugin's sitemap instead:

  • Yoast SEO: go to Yoast SEO, Settings, Site features and switch XML sitemaps on, under Technical SEO. The index lives at /sitemap_index.xml. Per Yoast's sitemap specification, it leaves out posts that are not set to be indexed and posts with a manual canonical URL, adds lastmod and images, and puts up to 1,000 URLs in each file.
  • Rank Math: turn on the Sitemap module under Rank Math SEO in your WordPress dashboard, then open Sitemap Settings. The index lives at /sitemap_index.xml. Each post type and taxonomy has an Include in Sitemap switch, and single posts can be excluded by ID (Rank Math guide).

Keep only one sitemap active: Yoast's help advises turning off other sitemap plugins.

How to make a sitemap on Shopify, Wix and Squarespace

You do not build one: Shopify, Wix and Squarespace generate the sitemap and update it as you publish. Your job is to keep the wrong pages out of it.

  • Shopify generates /sitemap.xml for every store, with child sitemaps for products, collections, pages and blog posts, including each product's main image, and updates it as you add them (Shopify Help Center). While a store is set to private mode, Google cannot read its sitemap. On the Basic plan or higher, stores with international domains get a sitemap for each domain, each submitted separately.
  • Wix keeps a sitemap index at /sitemap.xml, with a child sitemap per feature, such as /store-products-sitemap.xml or /blog-posts-sitemap.xml, and updates it whenever you change the site. After you complete Wix's SEO Setup Checklist, Wix submits the index to Google for you. A page whose canonical you point elsewhere can drop out of it (Wix Help Center).
  • Squarespace generates /sitemap.xml with your page URLs and image metadata. It leaves out disabled pages, pages hidden from search and password-protected pages, and you cannot edit the file. Changes usually show within an hour, at most 24 hours. Trial sites have no sitemap (Squarespace Help Center).

How to create a sitemap in Next.js and static site generators

Next.js

In the Next.js App Router, create app/sitemap.ts and export a function that returns your URLs. Next.js serves the result at /sitemap.xml (Next.js docs):

import type { MetadataRoute } from "next"
import { getPosts } from "@/lib/posts" // your own data source

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const posts = await getPosts()
  return [
    { url: "https://www.example.com/", lastModified: "2026-11-02" },
    { url: "https://www.example.com/pricing", lastModified: "2026-10-14" },
    ...posts.map((post) => ({
      url: `https://www.example.com/blog/${post.slug}`,
      lastModified: post.updatedAt,
    })),
  ]
}

Two changes from the example in the Next.js docs are worth making: replace lastModified: new Date(), which stamps every URL with the build time, with each page's real update date, and drop changeFrequency and priority, which Google ignores. The route is cached by default, so rebuild or revalidate it when you publish. Past 50,000 URLs, use generateSitemaps to split the list into files such as /product/sitemap/1.xml, and list each one in app/robots.ts, whose sitemap field takes an array.

Hugo, Jekyll, Astro and Gatsby

Static site generators have a sitemap built in or one official plugin away. Each writes the file at build time, so it stays current as long as you rebuild when you publish:

GeneratorHow to turn the sitemap onOutputLeave a page out
HugoBuilt in, nothing to installsitemap.xml at the root of publicSet disable: true under sitemap in the page's front matter
JekyllAdd the jekyll-sitemap gem and list it under plugins in _config.yml (GitHub Pages ignores a Gemfile-only setup)/sitemap.xmlsitemap: false in the page's front matter
AstroRun npx astro add sitemap and set site in astro.config/sitemap-index.xml and /sitemap-0.xmlThe filter() option
GatsbyInstall gatsby-plugin-sitemap and set siteUrl/sitemap-index.xml and /sitemap-0.xml, in production builds onlyThe excludes option

Set your production URL first (baseURL in Hugo, url in Jekyll, site in Astro, siteUrl in Gatsby), since the absolute URLs come from it. Details: Hugo, jekyll-sitemap, Astro (which cannot list dynamic routes in SSR mode) and Gatsby.

How to create a sitemap for a website with a crawler

For a hand-coded site, an old CMS or a broken sitemap, crawl the site and build the file from what the crawler finds. Our free XML sitemap generator starts at your home page, follows your links and robots.txt, keeps only pages that answer 200, allow indexing and are their own canonical, takes lastmod from your server's Last-Modified header when that date is real, and hands you a sitemap.xml. Free, no signup, up to 500 pages per run.

On a site under 500 pages, it doubles as a test: an indexable page missing from the result usually has no plain HTML link pointing to it, which also makes it harder for Googlebot to find.

For larger sites, use your CMS or a desktop crawler. Screaming Frog's SEO Spider is free up to 500 URLs and unlimited with a paid licence, and by default its sitemap leaves out noindex, canonicalised, robots.txt-blocked and non-200 pages (Screaming Frog guide). A crawled sitemap is a snapshot: crawl again when you add pages.

Sitemap size limits and when you need a sitemap index

You need a sitemap index only when one file cannot hold your list: each sitemap is capped at 50,000 URLs or 50MB uncompressed. Past that, split the URLs over several sitemaps, list those files in a sitemap index and give search engines only the index. The index is a short XML file of its own: a sitemapindex element with one sitemap entry per file, each holding a loc and an optional lastmod.

The rules, from Google's page on managing large sitemaps and its Sitemaps report help:

  • An index lists up to 50,000 sitemaps, and it cannot list other indexes.
  • The sitemaps it lists must be on the same site, in the same directory as the index or below it.
  • Files may be gzipped (.xml.gz), but the 50MB limit applies to the uncompressed size.
  • Search Console accepts up to 500 sitemap indexes per site.

Most tools split long before 50,000. WordPress core puts up to 2,000 URLs in each file, Yoast 1,000, Astro and Gatsby 45,000, and Rank Math recommends 200. That is fine: search engines read the index and follow it to every file.

How to set lastmod, and why to skip priority and changefreq

Set lastmod to the date the page's content last changed in a meaningful way, and change it only then. Google uses the value only when it is consistently and verifiably accurate. It counts a change to the main content, the structured data or the links on a page as significant, and an updated copyright date as not.

  • Format. W3C Datetime: a date (2026-11-02) is enough, and a full timestamp needs a time zone (2026-11-02T14:30:00+00:00). Bing's sitemap guidance recommends both date and time.
  • Never stamp every URL with the same date. When every entry carries the build time or today's date, the field no longer says which pages changed, and search engines stop trusting it.
  • Skip priority and changefreq. In its 2023 note on sitemaps, Google wrote that it "still doesn't use the changefreq or priority elements at all", and Bing ignores both as well. Leaving them out loses nothing.

Accurate dates pay off later: our guide on getting Google to recrawl your site shows how lastmod steers what Google fetches again.

Where to put the sitemap, and how to check it

Put the sitemap at the root of the host it covers, and point to it from robots.txt with one line, anywhere in the file:

Sitemap: https://www.example.com/sitemap.xml

The line needs the full URL, belongs to no User-agent group and can repeat for several sitemaps; our robots.txt guide shows it in a complete file. WordPress adds it for you, unless you uploaded your own robots.txt file, which replaces the one WordPress generates. In every other case, open /robots.txt and check that it points to the sitemap you actually use.

Then check the file before you hand it over:

  1. Open it in a private browser window. You should see XML, not a 404, a login page or your theme's HTML.
  2. Validate it. The free sitemap checker finds your sitemaps from robots.txt and the usual paths, then flags relative URLs, unescaped ampersands, URLs on other hosts, duplicates, more than 50,000 URLs and identical lastmod dates.
  3. Test it as Googlebot. In Search Console, inspect the sitemap's own URL and click Test live URL. Google's Sitemaps help suggests this before you submit: Page fetch should say Successful.

Finally, submit it in Search Console's Sitemaps report and in Bing Webmaster Tools. If the site is not in Search Console yet, start with our Google Search Console verification guide; then follow the walkthrough on submitting a sitemap to Google, which explains every status the report can show.

What we found in the sitemaps of 1,513 sites

On November 11, 2026, we looked at 1,513 sites connected to IndexMachine and at the latest Search Console state of 1,239,239 URLs from their sitemaps. We publish totals only and name no site or URL. Their owners signed up for an indexing tool, so these sites lean toward indexing trouble, and the states are not all fresh: on about 3 in 4 sites the newest state was more than a month old, and on about a third more than three months old. On most of the sites, IndexMachine had not requested indexing for any page, so the numbers show sitemaps as their owners and platforms built them.

28.7% of the sites listed at least one URL that Google will not index as it stands. 42,277 of the URLs (3.4%), on 434 sites, were in a Search Console state that means the listed URL itself will not be indexed: it redirects, returns 404, carries a noindex tag, has its canonical pointing elsewhere or is treated as a duplicate. Noindex was the most widespread, on 169 sites; our guide to finding and fixing a noindex tag shows how to tell whether the tag or the listing is the mistake. Robots.txt blocks were rare: 18 sites (1.2%) listed URLs that their own robots.txt blocks, so Google cannot crawl them. What matters when you make the file:

  • At scale, it is a template. 173 of the 434 sites had exactly one such URL, a single stray page. But the 32 sites with more than 100 each held 39,341 of the 42,277 (93.1%). When hundreds of URLs share a state, fix the template or plugin setting that lists them, not the URLs one by one.
  • 19 sites (1.3%) listed more than 50,000 URLs, the point where one file is no longer enough. For almost everyone else, a sitemap index is a convenience, not a requirement.

Here is how the share of sites with such URLs grew with the size of the sitemap:

URLs in the sitemapSitesSites with at least one such URL
1 to 1033132 (9.7%)
11 to 5043497 (22.4%)
51 to 10013140 (30.5%)
101 to 500431145 (33.6%)
501 to 2,0009655 (57.3%)
2,001 to 10,0005033 (66.0%)
More than 10,0004032 (80.0%)

The bigger the sitemap, the more likely it lists URLs that cannot be indexed. With 10 URLs or fewer, 9.7% of sites had one; past 500 URLs, most did (57.3% to 80.0% of each group). Large sitemaps come from templates and plugins, and nobody reads them line by line. Validate the file, then check which of its URLs Google actually indexed: of the 1,239,239 URLs, only 28.1% were indexed.

From a finished sitemap to indexed pages

A finished sitemap tells search engines which pages exist. It does not get them indexed: Google still has to crawl each URL and decide to keep it, and the direct way to ask by hand is Request indexing in URL Inspection, one URL at a time, within a daily quota.

That asking is the part IndexMachine takes over, and the file you just made is where it starts. Each page you add to the sitemap is picked up automatically and gets Google's own Request Indexing in your Search Console, on autopilot: the IndexMachine Chrome extension presses the button for you every day, and your full daily Google quota on every site goes to pages that are not on Google yet. Pages Google already shows as indexed are skipped, so no quota is wasted. The same new pages reach Bing, Yandex, Seznam, Naver and the other IndexNow engines through unlimited IndexNow, the pairing Bing's own guidance recommends: sitemaps for coverage, IndexNow for speed. Every requested page is tracked until it is on Google. Of 1,841 pages requested, 1,418 (77%) were on Google, typically in about 3 days by our first check. Pay once for lifetime access, or subscribe.

Your sitemap is ready. Next: get its pages indexed

A free IndexMachine account imports your Search Console sites, picks up the pages in the sitemap you just made and marks every one Google has not indexed yet. Switch on daily Request Indexing in your own Search Console and unlimited IndexNow once you want those pages found.

FAQs

Does the sitemap file need a specific name?

No. Any name works, in any folder above the URLs it lists, as long as you tell search engines where it is in robots.txt and Search Console. sitemap.xml at the root is the convention and the first place most tools look, so use it unless your platform picks another name, like WordPress's /wp-sitemap.xml.

How do I make a sitemap without a plugin?

On WordPress you already have one at /wp-sitemap.xml, built in since version 5.5. On any other site, write the XML by hand for a few dozen pages, or run a free sitemap generator that crawls the site and gives you a file to upload. Shopify, Wix and Squarespace need neither.

How often should I update my sitemap?

Every time you add, remove or move a page, or change a page's content in a meaningful way. Sitemaps from WordPress, Shopify, Wix, Squarespace, Next.js and static site generators update themselves when you publish or rebuild. A sitemap you wrote by hand or made with a crawler does not: regenerate it after every batch of changes.

Why is a new page missing from my sitemap?

Usually one of four reasons: the page is set to noindex or hidden from search (plugins and Squarespace leave those out on purpose), its canonical points to another URL, the sitemap is cached or built at deploy time and has not been rebuilt yet, or a crawler made the file and found no link to the page. Fix the cause, then reload the sitemap URL. On Squarespace, a change can take up to 24 hours to show.

How do I make an XML sitemap from a list of URLs?

Put each URL in its own url entry with a loc tag, wrap all the entries in one urlset element as in the example above, and save the file as UTF-8. For a long list, let a spreadsheet do the typing: URLs in column A, ="<url><loc>"&SUBSTITUTE(A1,"&","&amp;")&"</loc></url>" in column B and filled down, then paste column B between the opening and closing urlset tags. The formula also escapes every & in the URLs.

Elevate your digital presence

Getting your pages indexed by Google is the first crucial step in your search engine optimization journey.
Fix indexing issues. Let the SEO magic begin.

Try free, see which pages Google hasn't indexed

Free account. Import may take a while for big sites, Google rate-limits Search Console.

See pricing