How to Create XML Sitemap – Beginners Tutorial

arp14 Tutorial, XML Tags: , , , , 0

XML SitemapYou will learn how to create XML Sitemap, how it is formatted, what it is for, how search engines crawls websites via Sitemap and many more in this article. You need to know XML for this tutorial. If you don’t have any previous knowledge on XML, I suggest you to read this article – Learn Basic XML – Tutorial for Beginners.

“Site” + “Map” = Sitemap – the meaning is clearly defined within it’s name. “Site” means website and “Map” is map – so it is map of website. Sitemap mainly represents structure of websites. It helps to navigate our websites quickly. XML is designed to hold structured data, that is why any sitemap is written / created in XML. Later, the XML Sitemap is some how fetched via PHP, ASP, etc.and represented within HTML with nice styles like this – Sitemap. To get listed in search results of popular search engines like Google, Bing, Yahoo! etc. basically we need to submit our sitemap (sitemap.xml) to them, and they will crawl our site to make our pages listed. They also automatically crawl our site even we don’t submit out sitemap to them. As this is a automated process, there are chances of not crawling of all pages we want it to be listed.

Regular XML Sitemap

XML Sitemap tags and their description

TagNeedDescription
urlsetrequiredEncapsulate the file and references the protocol standard.
urlrequiredParent tagfor each URL entry. All other tags are children of this tag.
locrequiredURL of the page – this URL must begeins with the protocol (such as http) and end with a trailing slash, if your web-server requires it.
lastmodoptionalThe last modification date of the file. This date should be in W3C Datetime format. You can omit the time portion, it desired, and use YYYY-MM-DD format.
changefreqoptionalHow frequent the page is likely to change / How often to crawl. Values are: “always”, “hourly”, “daily”, “weekly”, “monthly”, “yearly” and “never”.
priorityoptionalThe priority of this URL relative to other URLs in your site. Valid values range from 0.0 to 1.0. The default priority is 0.5 for each page. It does not affect to page ranking, it’s just for specific importance.
image:imageoptionalThis tag contains images. It is valid if there is any image available in the page mentioned in “loc” tag.
image:locoptionalUrl of the image. This URL must begeins with the protocol (such as http).
image:titleoptionalHolds title of the image.
image:captionoptionalHold caption for the image.

 

Format of a XML Sitemap

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://w3epic.com/wp-content/plugins/wordpress-seo/css/xml-sitemap-xsl.php"?>
    <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" 
    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" 
    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

    <url>
        <loc>http://w3epic.com/2012/10/20/learn-html-in-one-day-online-tutorial-for-beginners/</loc>
        <lastmod>2013-02-12T19:49:20+00:00</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
        <image:image>
            <image:loc>http://w3epic.com/wp-content/uploads/2012/10/pic1.jpg</image:loc>
            <image:title>Example picture as reult of img tag</image:title>
            <image:caption>Result</image:caption>
        </image:image>
    </url>
    <url>
        <loc>http://w3epic.com/2012/10/20/learn-css-online-for-beginners-part-1/</loc>
        <lastmod>2012-10-30T16:32:46+00:00</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
    </url>
    <url>
        <loc>http://w3epic.com/2012/10/20/learn-css-online-advance-in-details-part-2/</loc>
        <lastmod>2013-02-20T19:30:04+00:00</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
    </url>
    <url>
        <loc>http://w3epic.com/2012/10/20/learn-basic-xml-tutorial-for-beginners/</loc>
        <lastmod>2012-10-30T16:17:16+00:00</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
    </url>
    <url>
        <loc>http://w3epic.com/2013/02/15/run-opera-mini-on-pc-windows-at-fullscreen/</loc>
        <lastmod>2013-02-20T09:49:52+00:00</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.6</priority>
        <image:image>
            <image:loc>http://w3epic.com/wp-content/uploads/2013/02/microemu_snap1.png</image:loc>
            <image:title>Run Opera Mini on PC using MicroEmulator</image:title>
            <image:caption>MicroEmulator snapshot</image:caption>
        </image:image>
        <image:image>
            <image:loc>http://w3epic.com/wp-content/uploads/2013/02/Opera-Mobile-Emulator-Screenshot-Cybersters-Blog-262x300.png</image:loc>
            <image:caption>Opera Mobile Emulator Screenshot    Cyberster</image:caption>
        </image:image>
    </url>
</urlset>

If there are multiple images available on a page, then “image:image” tag can be used multiple times for each image.

XML Sitemap Index

Sitemap files have a limit of 50,000 URLs and 10 megabytes per sitemap as per information on Wikipedia. More URLs you have in your sitemap and it’s become more messy – that’s why Sitemap Index for. Sitemap index files may not list more than 50,000 Sitemaps and must be no larger than 10MB and can be compressed. You can have more than one Sitemap index file.

XML Sitemap Index tags and their description

TagNeedDescription
sitemapindexrequiredSame as urlset tag.
sitemaprequiredEncapsulate the information about an individual sitemap.
locrequiredURL of the sitemap.
lastmodoptionalThe modification date of sitemap file.

 

Format of a XML Sitemap Index

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://w3epic.com/wp-content/plugins/wordpress-seo/css/xml-sitemap-xsl.php"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>http://w3epic.com/post-sitemap.xml</loc>
        <lastmod>2013-02-21T07:27:40+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>http://w3epic.com/page-sitemap.xml</loc>
        <lastmod>2013-02-22T07:58:17+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>http://w3epic.com/category-sitemap.xml</loc>
        <lastmod>2013-02-21T07:27:40+00:00</lastmod>
    </sitemap>
    <sitemap>
        <loc>http://w3epic.com/post_tag-sitemap.xml</loc>
        <lastmod>2013-02-21T07:27:40+00:00</lastmod>
    </sitemap>
</sitemapindex>
You can generate free XML Sitemap using sites below
Having problem? Just comment below. I’ll be back to you 🙂

Leave a Reply

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