First of all I would like to thank all who has asked me the questions about sitemap like – what is sitemap? Why sitemap is required? Who requires sitemap? What is the format of a sitemap? How to validate a sitemap? And many more.

Writing good sitemap for your website


In this tutorials section I will cover all about sitemap.

1. What is sitemap?

  • A sitemap is an XML file
  • It contains some predefined XML tags and some basic information about your webpages.
  • Among the information that a sitemap contains, is your individual webpage URL, last modified date of the page, how frequently you change your page content etc.

2. Why sitemap is required?

  • The main purpose of sitemap is making your page indexing faster by webmasters.
  • The sitemap is used to welcome the webmasters and index your site as soon as possible.
  • It is required to make work simple for the web robots.
  • As soon as you submit your ready made sitemap to the webmaster, the webmaster came to know in advance where to go for indexing you pages. Other wise the robot needs to
  • make a sitemap of your website. Which slows down your page indexing by webmasters.

3. Who requires sitemap?

  • It is required if you run a website like, a blog, a forum, online e-commerce service or any website it may be.

4. What is the format of a sitemap?

A sitemap is an XML file, so it is written in XML. Following is the simple sitemap format for a single page of your website:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.tutorialstutor.com/</loc>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>

</urlset>

Sitemap XML tag details:

 

<?xml version="1.0" encoding="UTF-8"?>
  • <?xml> tag specifies the version and encoding character set of the XML you are using
  • here it is version 1.0 and
  • the encoding for the file used is UTF-8.
  • So UTF-8 character set is used to encode the page
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  • <utlset> tag is a mandatory tag
  • this tag specifies the namespace(protocol standard) for the sitemap
<url> (mandatory)
  • <url> tag is a mandatory tag
  • this tag is the parent tag for a page which includes other child tag like <loc>,<lastmod>,<changefreq> etc. for the webpage
<loc>http://www.tutorialstutor.com/</loc>
  • <loc> tag is a mandatory tag.
  • This tag refers to the page URL, you are going to include in your sitemap for indexing by the webmasters.
  • URL must starts with the protocol (http or https)
  • URL can be up to 2048 characters
<lastmod>2005-01-01</lastmod>
  • <lastmod> is an optional tag
  • This tag tells the webmaster, when this page was last modified.
  • The date should be in W3C Datetime or you can Use the date format YYYY-MM-DD.
<changefreq>monthly</changefreq>
  • <changefreq> is an optional tag.
  • This is used to notify the webmasters, how frequently you update the file and how frequently the webmasters should recrawl.
  • Following is the list of values that this tag can have.
    • always
    • hourly
    • daily
    • weekly
    • yearly
    • never

“always” should be used if your documents change each time they are accessed.

<priority>0.8</priority>
  • <priority> is an optional tag.
  • This tag sets the priority value for your URL.
  • The priority is relative to other pages in your website only.
  • The priority value ranges from 0.0 to 1.0
  • This tag let’s search engines to know which page should be indexed first.
  • Default priority is set to 0.5

 XML Sitemap Example: Following is an example sitemap for a website having  few URLs.

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

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

   <url>

      <loc>http://www.tutorialstutor.com</loc>

      <lastmod>2016-11-01</lastmod>

      <changefreq>monthly</changefreq>

      <priority>0.8</priority>

   </url>

   <url>

      <loc>http://www.tutorialstutor.com/catalog?item=12&amp;desc=sitemap-generation</loc>

      <changefreq>weekly</changefreq>

   </url>

   <url>

      <loc>http://www.tutorialstutor.com/catalog?item=73&amp;desc=what-is-sitemap</loc>

      <lastmod>2016-12-02</lastmod>

      <changefreq>weekly</changefreq>

   </url>

   <url>

      <loc>http://www.tutorialstutor.com/catalog?item=74&amp;desc=how-to-generate-sitemap</loc>

      <lastmod>2016-12-05</lastmod>

      <priority>0.7</priority>

   </url>

   <url>

      <loc>http://www.tutorialstutor.com/catalog?item=83&amp;desc=how-to-validate-sitemap</loc>

      <lastmod>2016-12-03</lastmod>

   </url>

</urlset>

Things to remember during sitemap generation: Following are the important things you have to remember during a sitemap generation -

  • A sitemap XML file can contains maximum 50000 URLs
  • The size of an XML sitemap cannot be more than 50 MB.
  • The data values in the XML file must be entity-escaped.

Entity escaping:

To avoid sitemap errors, always remember that you have escape all entities in your data values (including URLs) in the sitemap. Look at the above examples that we have replaced all entities like (& replaced with &amp;). Likewise you have to replace them too. So remember the following list:

Character Character to be replaced Replace with
Single Quote &apos;
Double Quote &quot;
Ampersand & &amp;
Greater than > &gt;
Less than < &lt;

5. How to validate a sitemap?

Their are lots of free as well as paid online sitemap validator, you can google it and by giving your sitemap URL you can check it. But what I prefer and often I do, I simply submit my sitemap to the webmasters directly and the webmasters check and gives you the status. To submit your sitemaps to the webmasters first upload your sitemaps to your website root folder. Then copy the URL of you sitemap and paste it in webmasters, that’s all.

Check Page Rank