How to Create an XML Sitemap (and Submit It to Google)

How to Create an XML Sitemap (and Submit It to Google)

Just as it’s difficult to find a new destination without a map, it’s sometimes hard for Google to find all the pages on your website without a sitemap.

Luckily, it’s quick and easy to create and submit an XML sitemap to Google.

Below, we walk through how to do this step by step.

But first, let’s cover a few basics.

What is a sitemap?

A sitemap is an XML file listing all the important content on your website. Any page or file that you want to show up in search engines should be in your sitemap.

Sitemaps can’t list more than 50,000 URLs, and they can’t be more than 50mb in size. If your sitemap exceeds one or more of those figures, then you’ll need to create more than one.

What does an XML sitemap look like?

XML sitemaps are made for search engines, not humans. They can look a bit daunting if you’ve never seen one before.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">

Let’s break this down.

XML declaration

<?xml version="1.0" encoding="UTF-8"?>

This tells search engines that they’re reading an XML file. It also states the version of XML and character encoding used. For sitemaps, the version should be 1.0, and the encoding must be UTF‑8.

URL set

<urlset xmlns="">

This is a container for all the URLs in the sitemap. It also tells crawlers which protocol standard is used. Most sitemaps specify the Sitemap 0.90 standard, which is supported by Google, Yahoo!, and Microsoft amongst others.



This is the parent tag for each URL. You must specify the location of the URL in a nested <loc> tag. Crucially, these must be absolute, not relative, canonical URLs.

Although this is the only required tag here, there are a few optional properties:

  • <lastmod>: Specifies the date when the file was last modified. This must be in the W3C Datetime format. For example, if you updated a post on September 25th, 2019, the attribute would read 2019-09-25. You can also include the time, but this is optional.
  • <priority>Specifies the priority of the URL relative to all other URLs on the site. Values range between 0.0 and 1.0. Higher is more important.
  • <changefreq>Specifies how frequently the page is likely to change. Its job is to give search engines some idea as to how often they might want to recrawl the URL. Valid values here are alwayshourlydailyweeklymonthlyyearly, and never.

None of these optional tags are that important for SEO.

For <lastmod>, Google’s Gary Ilyes states that they ignore it in most cases as “webmasters are doing a horrible job keeping it accurate.” Since most sitemap generators set this to the current date for all pages, and not the date when the file was last modified, it’s easy to see why.

For  <priority>, Google says they ignore this tag because it’s just a “bag of noise.”

For  <changefreq>, John Mueller says “Priority and change frequency doesn’t really play that much of a role with Sitemaps anymore.”

Why do I need a sitemap?

Google discovers new content by crawling the web. When they crawl a page, they pay attention to both internal and external links on the page. If a discovered URL is not in their search index, they can parse its contents and index it where appropriate.

But Google can’t find all content this way. If a web page isn’t linked to from other known pages, they won’t find it.

This is where sitemaps come in.

Sitemaps tell Google (and other search engines) where to find the most important pages on your website so they can crawl and index them.

This is important because search engines can’t rank your content without first indexing it.

How to create a sitemap

Some CMS’ generate a sitemap for you. These are automatically updated when you add or remove pages and posts from your site. If your CMS doesn’t do this, then there’s usually a plugin available which does.

Creating a sitemap in WordPress

Even though WordPress powers 34.5% of websites, it doesn’t generate a sitemap for you. To create one, you need to use a plugin like Yoast SEO.

To install Yoast SEO, login to your WordPress dashboard.

Go to Plugins > Add New.

Search for “Yoast SEO.”

Search for “Yoast SEO.”

Hit “Install now” on the first result, then “Activate.”

yoast seo search sitemap

Go to SEO > General > Features. Make sure the “XML sitemaps” toggle is on.

xml sitemap yoast submit google

You should now see your sitemap (or sitemap index) at either or

Hit “Install now” on the first result, then “Activate.”

SIDENOTE. If your WordPress installation lies in a subfolder or subdomain, then your sitemap is located under that path. For example, the sitemap for our blog is accessible at

If you want to specifically include or exclude certain types of content (tags pages, category pages, etc.) from your sitemap, head to the “Search Appearance” settings.

You can also exclude individual posts or pages from the “Advanced” meta box on the editor.

IMPORTANT. Only exclude pages from your sitemap that you don’t want to show up in search results.
Learn more in our guide to WordPress SEO.


Share post: