How To Build A Sitemap.xml File

A big part of any search engine optimization strategy is helping Google’s search bots crawl your website efficiently and effectively, so they know which webpages you want indexed and included in search results. 

There are several things that go into this process, but one of the most important is building and submitting a sitemap. But if you’re not code savvy, the process of creating and submitting a detailed map to your website may sound intimidating.

Don’t worry. It’s a lot easier than it sounds.

What is a Sitemap?

 A sitemap, as you probably already figured out, is a map of your website. It tells search engines which pages you want to be searchable and provides them with information about your content.

Modern sitemaps (i.e., those created after 2005) are in XML, or eXtensible Markup Language, a format that makes it easy to store and parse data from URLs. Versatile and extensible, they can be used to provide additional information about images, videos and news content.  

Do You Need a Sitemap?

As a rule of thumb, a sitemap is generally a good idea for any site as it improves crawlability. However, there are some specific circumstances in which a sitemap may not be necessary. 

These include:

  • Small websites with 500 or fewer pages that you want included in search results
  • Sites with comprehensive internal linking
  • Sites without many media files

However, even if your site checks all these boxes, having an xml sitemap isn’t going to hurt and it’s an absolute must for:

  • Large websites, especially those with structures that make it difficult for searh spiders to fully crawl them.
  • New websites with few inbound links by which Google can discover it.
  • Sites that use a lot of media or are shown in Google news.

Sites that only include webpage URLs can be submitted using a text file with one web address per line. 

If you’re in doubt, you should go ahead and create a sitemap.xml file and submit it to Google. 

How to Create an XML Sitemap

There are two ways you can create a sitemap.xml file: manually or automatically. We’ll look at both to give you better insight into the process and help you decide which is best for you.

Manually building a Sitemap.xml 

1. Collect the URLs that will be included

Figure out which pages you want included in your sitemap and make a list of the web address of each one. 

To find out which pages Google has already indexed, you can do a site search by typing site:YourWebsite.com into the search bar. 

You don’t want to include every page on your site in your xml file as there will invariably be some pages you don’t want to make searchable. These could include things like confirmation pages, author pages, 404s, etc. Make sure these are not part of your list. 

2. Create Your Sitemap in a Text Editor

Using a text editing program like Windows Notepad, you can follow the syntax outlined in Google’s Sitemap Formats section to manually code all your URLs in XML format. 

At its most basic, this will look something like:

<urlset xmlns=”htps://www.sitemaps.org/schemas/sitemap.0.9”>

<url>

<loc>https://YourSite.com/</loc>

</url>

If you’re more advanced, you may include additional information using other tags to tell Google when the page was last modified, how frequently it changes and its relative priority to other pages. 

If your website requires the use of more than one XML sitemap, you’ll need to use a sitemap index, which is a sitemap of your other sitemaps. 

There are only two steps to manually building a sitemap.xml this way, but if your site is larger than a few pages or you’re not comfortable with coding syntax, it can become a massive undertaking. 

A better way to build your sitemap is to let your CMS generate it for you.

Automatically Building a Sitemap Using Your CMS

Most organizations run their websites via a content management system or CMS. You’re probably familiar with many of these, including WordPress, Blogger and Wix. 

If you’re using one of these platforms, you can have it automatically generate your sitemap for you. You can then export the URLs from your database to either a CSV file or a file on your web server. 

How to Submit Your Sitemap

Once you’ve created your sitemap, it’s time to send it to Google. To do this, you’ll need to know where it lives. If you’re using a CMS plugin, it will likely be YourSite.com/sitemap.xml.

If you’ve manually compiled your sitemap make sure you name it clearly and upload it to your domain’s root folder. 

Once you have the URL, open Google Search Console and navigate to the Sitemaps section. From there, simply paste in the address and hit submit. 

Congratulations, you just built and submitted your sitemap.xml. 

Best Practices for Sitemaps

  1. Add your sitemap’s URL to your robots.txt file to make it easy for web crawlers to find.
  2. Only include URLs you want indexed – if you have multiple versions, include the canonical one.
  3. Keep your sitemap file to less than 50,000 URLs or 50MB
  4. Update your sitemap every time you add or change a URL 

Make Everything SEO Easy

Search engine optimization is a complicated process. From building and submitting sitelinks to generating inbound links, the checklist required to get to the top and stay there is huge. 

But now there’s an easier way. Evisio was made for busy SEO professionals and entrepreneurs alike, automatically scanning your website for SEO issues and then providing you with an easy-to-understand, step-by-step list of instructions to help you fix problems and capitalize on opportunities. 

It’s the best way to improve your efficiency and help ensure your website is claiming its rightful place at the top of search engine results. See it for yourself. Contact me for a free trial.

< Go back to The SEO Program page.