31 December, 2008

How to create a google sitemap

Sitemaps an important fact in the realm of web development.

There are some benefits you can have with sitemaps, as listed bellow.
  1. helps to index the new pages and recent changes
  2. helps to index your webpages more quickly on search engines
  3. Also helps search engine to keep search content fresh
Now without going to much detail lets see how to create a site map, find bellow a very brief site map, which I will use to explain how to create your own one.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">


<url>
<loc>http://mysite.com/</loc>
<lastmod>2008-27-23</lastmod>
<changefreq>never</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>http://mysite.com/about</loc>
<lastmod>2008-27-23</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>http://mysite.com/contact</loc>
<lastmod>2008-27-23</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

</urlset>


Okay by having a quick glance at the example you will notice that this it XML, now dont panic if you dont know XML, its really easy to learn. Go to http://w3schools.com/ to find tutorials.
Now as a fact Google sitemaps are created using XML, right thats what I wanted to mention huh!.

think it is the time to review the sitemap,
Lets assume that my site is a three page website, all the pages are just and index page, an about page and a simple contact form. Have a look at the sitemap, can you see three code snippets just like this

<url>
<loc>http://mysite.com/</loc>
<lastmod>2008-27-23</lastmod>
<changefreq>never</changefreq>
<priority>1.0</priority>
</url>


Now for ease I would say that each of these snippets represents a web page. lets go through it, the whole thing is wrapped inside a url tag (simple xml tag huh!).

there notice the for tags nested inside the url tag. lets go through them first.

  1. <loc>= okay this is the location of your webpage. so it is my index page as well, and it is a complete url.
  2. <lastmod> = now this I wont have to explain, simply the last modified date.
  3. <changefreq> = this is the frequency you change your page. you can state the frequency with hourly,daily,weekly,monthly,yearly, never. Okay in my case I have not planned to change my webpage, so I have used never. I dont think I will have that much time to change it hourly huh! ;)
  4. <priority> = now this is another important data. the priority of your webpage in your site. You might be thinking of the greatest priority, with a lot of 9s. yeah lots of 9s make a big number, but google has their own way of specifying the priority. you can state it by using a decimal which is in the range of 0 - 1. The high priority one is 1 and the lowest is 0 anything can be used within here, 0.1, 0.2, ...., 0.8,0.9, 1. the 0.5 is the medium priority is 0.5.
Okay now we disscussed about the addition of the pages. now what about these


<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">


the first line says that the XML is using UTF-8 encoding, oh yes google needs in that way in order to accomadate special characters. and the second line decalres the namespaces.
now these two lines are going to be the same for any google sitemap. so you dont have worry, just do a copy and space.

Okay, now you are ready to create your sitemap, whoops! hell your site has 100 and 1 pages.
now what it will take days to create one, dont worry there are sitemap generators.

screen the following URLs,

http://www.sitemapspal.com/

No comments: