Categories

A Guide to XML Sitemap

Posted on: September 23, 2016 by Dimitar Ivanov

If you have ever wondered how to get indexed a web page faster, the answer is to have an XML sitemap. This article aims to help you getting started work with sitemaps. Also provides a guideline for the syntax, manual creation, generating and validation of an XML sitemap.

What is a sitemap?

A file in XML format that describes internal links of a website. The sitemap helps Google and other search engines to better understand the organization of your website pages. But don't fool yourself, having a sitemap wouldn't improve the ranking in SERPs.

Why to use sitemap?

There are a number of situations in which your website can benefit from a XML sitemap.

  • new website with few or no inbound links
  • broken or not-well organized site hierarchy
  • web pages that are isolated for some reason
  • very large website

XML Sitemap Specification

All tags supported by a sitemap are listed below.

  • <urlset> - specifies the protocol standard. The ancestor of all tags in the sitemap. This XML tag is required.
  • <url> - the parent tag of each URL set. This XML tag is required.
  • <loc> - specifies a URL of a resource. This XML tag is required.
  • <lastmod> - specifies the date of last modification of the resource. This XML tag is optional.
  • <changefreq> - specifies how often the content is likely to change. Valid values are: always, hourly, daily, weekly, monthly, yearly, never. This XML tag is optional.
  • <priority> - specifies the priority of current URL compared to the rest of URLs. Valid values range between 0.0 and 1.0. This XML tag is optional.

XML Sitemap examples

  • Minimal setup:
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        <url>
            <loc>http://www.example.com/contact.html</loc>
        </url>
        <url>
            <loc>http://www.example.com/news.html</loc>
        </url>
    </urlset>
    
  • Standard setup:
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        <url>
            <loc>http://www.example.com/contact.html</loc>
            <lastmod>2016-08-02</lastmod>
            <changefreq>monthly</changefreq>
            <priority>0.9</priority>
        </url>
        <url>
            <loc>http://www.example.com/news.html</loc>
            <lastmod>2016-09-23T18:15:20+00:00</lastmod>
            <changefreq>daily</changefreq>
            <priority>0.75</priority>
        </url>
    </urlset>
    
  • Multilingual website setup:
    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        <url>
            <loc>http://www.example.com/en-GB/page.html</loc>
            <xhtml:link rel="alternate" hreflang="fr-ca" href="http://www.example.com/fr-CA/page.html" />
        </url>
        <url>
            <loc>http://www.example.com/fr-CA/page.html</loc>
            <xhtml:link rel="alternate" hreflang="en-gb" href="http://www.example.com/en-GB/page.html" />
        </url>
    </urlset>
    

Sitemap guidelines

  • The values of all XML tags must be entity escaped.
  • The content type of a XML sitemap file must be application/xml.
  • The encoding of a XML sitemap file must be UTF-8.
Conclusion

The use of sitemap helps a website to being indexed by search engines. Despite that is not guarantee that all of the URLs in a sitemap will be crawled and indexed, Google says that your website will benefit from having a sitemap. There are plenty of free online services that will help you to generate and validate a XML sitemap. To make your sitemap available to Google, submit it using the Search Console Sitemaps tool.

See also
Share this post

If you have questions about XML sitemap, leave a comment below. Don't forget to share this article if you think it worths others to know about it. Thanks so much for reading!


0 Comments

Leave a comment

Captcha