ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Business and Employment»
  • E-Commerce & How to Make Money Online

How to Create a Sitemap Script

Updated on August 15, 2013

The When, the What and the How Of Sitemap for SEO

Search Engine Optimization experts all use the sitemap for a reason. Without a sitemap, the only real way for a crawler to locate your URL structure is via back-links to those URL's.
Search Engine Optimization experts all use the sitemap for a reason. Without a sitemap, the only real way for a crawler to locate your URL structure is via back-links to those URL's. | Source

How Does a Sitemap Help SEO?

A sitemap is an extremely important part of xml scripting. It was created for a search engines crawler.

When a visitor arrives at a website, not having visited it before, they may at some time get lost.

A webmaster will provide a page for these visitors called sitemap.The end result is a listing of every URL on that website so a visitor can click on the page that they are looking for.

This is good for a user to find everything easily, but a search engine doesn't use this for it's sitemap.

The sitemap for a user is in HTML.

The sitemap a search engine uses is in xml format.

The xml version is a similar listing, but with extra information regarding important aspects of each individual URL.

The priority, importance, update frequency, last time and date the URL was updated and most importantly, each individual URL's location.

When a new webmaster uses the script, it is understandable that they find it complicated.

The scripting language used is very simple. Within a couple of minutes a novice can easily start writing the script. Once finished it is then uploaded to the website as a page, ready for search engine submission along with the website.

The sitemap has to be readily available. All the time!

If a website isn't being accessed by a search crawler, then it wont have any available search queries. The reason being - if a search engine can't access a website, how can it be expected to show a search result?

A Script can Use Every Attribute

This script is incorporating every aspect of the sitemap script.
This script is incorporating every aspect of the sitemap script.

SEO Experts all Use the Sitemap Script

This is a basic script. The priority and change frequency have been left out. It is not a necessity to commit a priority to a URL. A search engine will prioritize URL's, essentially, by itself. This is the example being interpreted.
This is a basic script. The priority and change frequency have been left out. It is not a necessity to commit a priority to a URL. A search engine will prioritize URL's, essentially, by itself. This is the example being interpreted.

Sitemap Data Breakdown

Sitemap Parameters
<loc> </loc> - Location tag. This is where the URL of a page is inserted.
<changefreq> </changefreq> - Change frequency tag. A rough estimate of how often the page is updated.
<lastmod> </lastmod> - The last time the page was modified.
<priority> </priority> - The importance of the page is placed here ranging from a value of 0-1. Increments of decimal places are used to determine importance.

Increasing SEO with the Sitemap Script

There are 4 sections in the sitemap that are of use to a webmaster. The <loc> </loc> (location) <changefreq> </changefreq> (change frequency), <lastmod> </lastmod> (last modification) <priority> </priority> sections.

Although every pages URL is listed, not all of the sections have to be used.

The sections that are of most interest are the location, change frequency and last modification tag.

Although the priority section is able to be used, a search engine will in a way determine what websites pages are of more importance, or interest to a visitor.

The benefits of a website incorporating a sitemap script in there SEO plan is phenomenal.

Crawlers now have easy access to your entire websites URL structure and more importantly, vital information regarding those URL's.

The best way to "SEO" a sitemap so a crawler can find it, is to link to it from your robots.txt script.

Sitemap Protocol Tag

This sitemap only contains a single page. The home page. Specifying the protocol in the urlset start tag is what's being emphasized.
This sitemap only contains a single page. The home page. Specifying the protocol in the urlset start tag is what's being emphasized.

Create a Sitemap and Identify the Protocol

The program used to create the script is available on all windows systems, notepad.

It is easily found in the start menu.

If it isn't listed, just search for notepad in the search bar and the icon will be listed.

Once the sitemap is complete, it has to be saved as an xml file.

To save it as an xml sitemap file, simply save the script with the name sitemap.xml.

For a video demonstration visit SEO Basics

Look at the image above.

To start and end the script, the <urlset> </urlset> tag is used.

The start of the tag is where the protocol being used is placed. It is inserted after the first tag. i.e <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">.

The last urlset tag is placed to close the entire sitemap.

Everything else in between those tags is URL data.

The URL Parent Tag

The URL parent tag is used to start and end an individual URL within the sitemap.
The URL parent tag is used to start and end an individual URL within the sitemap.

Inserting URL's into a Sitemap Quick-Guide

Tools Needed
Notepad needs to be opened to type the script into.
The urslet tag needs to be entered to open and close the script.
Each listed URL has there own sequence. Starting and ending of an individual URL's data begins and closes with the URL parent tag. Then the child tag and other data is inserted between the tags.
The child tag is the <loc> </loc> tag. This is the location of the individual URL.
A sitemap will contain every websites page URL and data with there own parent and child tags.

Sitemap Script - Parent and Child Tags

The term parent and child tags is referring to the value of each of the tags.

the url tag is considered the parent tag as it is the tag needed to open or start the process of listing a URL.

The location tag is considered the child tag as it required after the parent tag. The inability to place it in the script without the use of opening and closing parent tags makes it redundant.

After the protocol and urlset tags are in place, it is time to set the URL parent and child tags.

Typing the opening parent tag is used to indicate that a URL and its credentials are being listed.

Once the tag is opened, it's time to place the pages location with the child tag.

The following example portrays a sitemap that is listing a URL.

<urlset xmlns="http://www.sitemaps.org./schemas/sitemap/0.9"> (This has set the URL Protocol and started a URL set).

<url> (This tells the crawler that a URL is about to be entered).

<loc>http://www.yourwebsite.com/</loc> (This has told the crawler the location of that url.

</url> (Closes off the previous listing. Repeat the entire process for another url).

</urlset> (This has closed the entire sitemap).

The Lastmod Tag is of Importance

Leaving out the lastmod tag is not good for a websites SEO.
Leaving out the lastmod tag is not good for a websites SEO.

The Last Modified Sitemap Tag Attributes

The tag for displaying the last modifications made to the page is the <lastmod> </lastmod> tag attribute.

The tag has many attributes that are applied.

The tag displays the date of last modification, the time of the update in 24hr format and the local time setting where the update was done. This is all written in American format, per the ASC (American Standards Code), as this is the code used for any computer scripting.

If a page was modified in Adelaide, Australia at 08:00 a.m in the morning. An updated lastmod tag would appear like so.

<lastmod>2013-05-05T00:08:00+09:30</lastmod>

The first section is for the date. The capital T sets the time. The last is the local time setting. Adelaide, Australia is GMT+09:30. All that gets written is numerical value.

Now you understand the concept of creating, adding attributes and modifying the script. Now it's time to write your own.

The Sitemap and SEO?

How do you think the sitemap impacts a search engine crawler?

See results

© 2013 Martin Heeremans

Comments

    0 of 8192 characters used
    Post Comment

    • Martin Heeremans profile image
      Author

      Martin Heeremans 4 years ago from Australia

      If you have pages that are on your server, which are no longer in use, the best option is to go to your webmaster tools account and delete the URL's from the search engines index. Then, delete the pages from your server.

    • Lee Tea profile image

      Lee Tea 4 years ago from Erie, PA

      Done. Thanks! I did a site:mysite.com search to see what had already been indexed. Turns out all my pages already have been, along with a few old ones...guess I should go in and delete them off my server? But I did the sitemap anyways, and uploaded my robots.txt file which was missing from my newly renovated site...hoping for more traffic in the near future. Thanks for your info!

    • Martin Heeremans profile image
      Author

      Martin Heeremans 4 years ago from Australia

      Apologies, my keyboard had a stutter for a moment. There is only meant to be one "to" in that previous comment

    • Martin Heeremans profile image
      Author

      Martin Heeremans 4 years ago from Australia

      Someone posted a comment and though it was valid, it had a link within it.

      There are tools out there that will create a sitemap for you. However, they aren't sufficient enough to to handle people who host on a sub-domain.

      If a website is hosted on a free hosting site, then it's in a sub-domain of that site. This is where the free generators have trouble understanding URL structure i.e www.yoursite.websitehostname.com

      I have seen some clients use, generators that have added duplicate URLS with two different priorities among other incorrect data.

      In the end, when explained correctly, it really is an easy script to understand.

    • Martin Heeremans profile image
      Author

      Martin Heeremans 4 years ago from Australia

      That's good to hear that your giving it a go! Just remember, when it comes to SEO on a Website, it's the small things that make a big difference.

    • Lee Tea profile image

      Lee Tea 4 years ago from Erie, PA

      I guess it is time to write my own! I built my site in kompozer using tutorials to learn how...things like this I have no idea about. I'd like more traffic, though, so I'll be adding this sitemap today. Thanks for the clue! You've explained this simply enough that I'm not afraid to try.