How to create a sitemap.xml

You added twenty new products to your store, but weeks later they still do not show in search results. A sitemap is a file that lists your pages for search engines, helping them find new ones without waiting to stumble on them.

Published · 2 min read

What is a sitemap?

An XML file listing the link to every page you want search engines to find, and sometimes the date each was last changed. You upload it to your site, then tell search engines where it is through their webmaster tools or in your robots.txt file. Many store platforms create one automatically, so check your platform first.

Worked example

The link https://example.com/about?x=1&y=2 is written like this, because & is written & inside XML:

An Arabic link is written in its encoded form, so «منتجات» becomes a string starting with %D9%85%D9%86. And the line “not a url” is rejected with its line number.

<loc>https://example.com/about?x=1&amp;y=2</loc>

How to do it

  1. Open the XML sitemap generator and paste your site's links, one per line, or upload a .txt or .csv file.
  2. Add the last-modified date if you know it, per link or one date for all.
  3. Check the warnings: invalid links, repeats and mixed hosts.
  4. Download the file and upload it to the root of your site.

Why doesn't the tool add dates or priority?

A date is only written when you supply it, because a wrong date makes search engines trust the file less. The tool does not offer changefreq and priority, because major search engines largely ignore them, and Google has said it does not use them.

Protocol limits

  • 50,000 links and 50 MB uncompressed per file, and 2,048 characters per link.
  • A longer list is split into several files plus a sitemap-index.xml, delivered as a ZIP.
  • All links should use the same host and protocol as the place you upload the file.
  • The tool does not crawl your site or discover pages, so making the list complete is up to you.

Add a Sitemap line to your robots.txt with the Robots.txt builder so every crawler knows where the sitemap is. Before adding links, make sure they are clean with the URL slug generator.

Common questions

Does a sitemap guarantee my pages show in search?

No. It helps search engines find pages, but indexing and ranking are their decision.

Should I list every page of my site?

List only the pages you want in search, not cart, account or internal search result pages.

Does the tool visit my site?

No. It only converts the list you give it, inside your browser.