Creating a valid sitemap.xml file for SEO

A sitemap is a great way to show search engines a list of all the webpages on your domain. It’s a best practice for Search Engine Optimisation!

I always suggest to use the Google Search Console dashboard to submit a sitemap to Google, and the Bing Webmaster Tools as well. By adding your sitemap to these dashboards, the pages that are included into that sitemap will very likely get indexed into each of these search engines.

A working sitemap.xml file example can be found below:

<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://vanhoutte.be/</loc>
</url>
</urlset>

Note that this is a barebones sitemap.xml template that only include the location <url> and nothing more. Other sitemap tag definitions to add more specifics for each URL can be found in the table below:

Tag Required? Description
<urlset>RequiredEncloses all information about the set of URLs included in the sitemap.
<url>RequiredEncloses all information about a specific URL.
<loc>RequiredSpecifies the URL. For images and video, specifies the landing page (aka play page).
<lastmod>OptionalShows the date the URL was last modified, in YYYY-MM-DDThh:mmTZD format (time value is optional).
<changefreq>OptionalProvides a hint about how frequently the page is likely to change. Valid values are:

  • always. Use for pages that change every time they are accessed.
  • hourly
  • daily
  • weekly
  • monthly
  • yearly
  • never. Use this value for archived URLs.
<priority>OptionalDescribes the priority of a URL relative to all the other URLs on the site. This priority can range from 1.0 (extremely important) to 0.1 (not important at all).

Note that the priority tag does not affect your site ranking in Google search results. Priority values are only considered relative to other pages on your site so, assigning a high priority (or specifying the same priority for all URLs) will not boost your entire site search ranking.

With the knowledge of the table above, we can for example create the following sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://vanhoutte.be/</loc>
<lastmod>2015-07-26</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url> </urlset>

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

Leave a Reply

Your email address will not be published. Required fields are marked *