Insights

How to Create and Submit a XML Sitemap

Building and submitting a sitemap is one of the best ways to ensure all of the valuable content on your site can be found by search engines. A sitemap is not the only way search engines can discover pages on your site but it is your "direct line" for telling Google what is important.

What is a Sitemap?

Google describes a sitemap as:

“... a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines read this file to more intelligently crawl your site.”

Sitemaps can have multiple formats such as XML (Extensible Markup Language ), RSS (Really Simple Syndication), and Text. The XML format is the most widely used and will be the format that we discuss for the rest of the article.

Do You Need a Sitemap?

The short answer is, not really depending on the size of your site and how your site is built. You probably don’t need a sitemap if you have a small site (<100 URLs) and all of the URLs are linked internally. But if you have a rather large site that has thousands, maybe millions/billions, of URLs, then having a sitemap will benefit you greatly.

How to Create an XML Sitemap

There are two ways to create an XML sitemap, the automatic way and building one from scratch. If you want to create an XML sitemap the automatic way, check out our Screaming Frog guide on how to create an XML sitemap.

[TIP]
Before creating a new sitemap, check if your site already has one!
Seer Resource: How to find your XML sitemap

To build an XML sitemap from scratch, please follow these steps:

Step 1: Gather all of your site’s URLs

There are a few ways to get a list of URLs for your website. The easiest way is to use a crawler like Screaming Frog to crawl your entire website to find all URLs. If you don’t have a copy of Screaming Frog, you can also find your URLs by:

  • Manually looking at your site and collecting all URLs
  • Perform a site search in Google to identify the URLs that Google has in its index
  • Look at Google Analytics landing page report to find URLs

The most important thing to keep in mind when gathering URLs for a sitemap is to determine if you want Google to index that specific page. For example, your homepage is most likely a page you want in the index but not your privacy policy or terms and conditions page.

Step 2: Code the URLs

Once you have a list of URLs that you want to include in your sitemap, it is time to code the URL in an XML format. In order to code the URLs in the proper format, you’ll need a text editor such as Sublime Text.

A) Start by opening a <urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"> tag

pasted image 0 9

B) Next, add your URL using the <url> and <loc> tags

pasted image 0 8

C) You can stop here if you like but there are other optional tags that you can use to add more detail to your sitemap. Optional tags are:

  1. <lastmod>: The date the page was last modified.
  2. <changefreq>: How often does the page change?
  3. <priority>: How important is this page compared to your other pages. Values for this range from 0.0 to 1.0 with 1.0 being the highest priority

pasted image 0 10

D) Close with a closing </url> and </urlset> tag

pasted image 0 5

How to submit your sitemap to through Google Search Console

Now that you have your XML sitemap created, it’s time to submit it to Google through Search Console. Here’s how you can do that in a few easy steps:

1. Sign into Google Search Console and click “Sitemaps” in the left sidebar

pasted image 0 6

2. Add the URL of your sitemap at the top of the page where it says “Add a new sitemap”

pasted image 0 7

3. Click submit and Google will crawl your newly created XML sitemap.

If you like this article, you should check out our newly updated Screaming Frog Guide that is packed full of tips and tricks to do almost anything.

 


Get more posts like this - delivered straight to your inbox:

Sign up for newsletter

We love helping marketers like you.

Sign up for our newsletter to receive updates and more: