homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

XML Sitemap - how to? free tools online? any good?

WebmasterWorld Senior Member 10+ Year Member

Msg#: 4240087 posted 1:52 pm on Dec 8, 2010 (gmt 0)

Ok, I have a few sites and not one XML sitemap.. perhaps it is time I got one or two.

I have never done anything in XML...

How do I generate an XML Sitemap?

Can I use the free tools online, like [xml-sitemaps.com...] ?

Is there anything wrong with using my existing html sitemaps?


brotherhood of LAN

WebmasterWorld Administrator brotherhood_of_lan us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4240087 posted 2:18 pm on Dec 8, 2010 (gmt 0)

The link you posted does a fine job of creating an XML sitemap, for small sites. The online tools are limited/slow because they have to crawl your site to find links and rely on the presence of a last modification header to add that data to the sitemap.

If you have experience with a server-side language you can generate/manage your sitemap using that. PHP has some handy XML functions to manipulate XML.

When you have a very large site, you will need to make sitemap index files. This is a good read to familiarise yourself with site maps: [sitemaps.org...]

Below is a very simple PHP script I made to manage an XML sitemap. It creates an MD5 of the URL so entries can quickly be found when requiring an edit. I edited slightly but it should work as is.


class sitemap
   public function __construct()
   public function load() 
   global $dom;
   $dom = new DOMDocument;
   $dom->preserveWhiteSpace = true; 
   public function generate($flag)
   global $categories,$dom,$urlset;
   $dom = new DOMDocument();
$dom->loadXML('<?xml version="1.0" encoding="UTF-8"?>

   $urlset = $dom->getElementsByTagName('urlset')->item(0);
   // Example adding of home page
   // Iterate through the rest of your known website URLs here and apply this function
   // $array contains key=>value pairs to add to the sitemap where 'key' is a tag and 'value' is its contents
   public function add_url($vars)
   global $dom,$urlset;
         $urlset = $dom->getElementsByTagName('urlset')->item(0);
   $node = $dom->createElement('url');
      foreach($vars as $key => $var)
      $node2 = $dom->createElement($key);
      $node3 = $dom->createTextNode($var);
   $newnode = $urlset->appendChild($node);
   $vars['md5'] = md5($vars['loc']);
   public function editlastmoddate($id)
   global $dom;
   $xpath = new DOMXPath($dom);
   $mod = $xpath->query("/urlset/url[@id='$id']/lastmod");
   $mod->item(0)->nodeValue = strftime("%Y-%m-%d",time() - gmmktime() + mktime());
   public function deleterow($id)
   global $dom;
   $xpath = new DOMXPath($dom);
   $urlset = $dom->getElementsByTagName('urlset')->item(0);
   $row = $xpath->query("/urlset/url[@id='$id']")->item(0);



WebmasterWorld Senior Member 10+ Year Member

Msg#: 4240087 posted 9:03 am on Dec 9, 2010 (gmt 0)

Hi brotherhood of LAN
thanks for that.
Not completely sure I understand it :-)

Actually, wondering if I really need a sitemap. My sites are pretty straightforward and all the pages are easily found by crawling. All the pages I want to be found that is.


WebmasterWorld Senior Member piatkow us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 4240087 posted 12:00 pm on Dec 9, 2010 (gmt 0)

I found a sitemap a benefit. For a small, reasonably static, site its easy enough to create in a standard text editor.


5+ Year Member

Msg#: 4240087 posted 6:27 am on Dec 10, 2010 (gmt 0)

1) For small sites (<500 pages), you can use the site mentioned in your original post. For bigger sites, you can download free app like GSitecrawler to generate XML or txt sitemaps

For CMS like wordpress there are readymade sitemap plugins to generate XML or HTML sitemaps.

2) Having sitemap aids in crawl discovery, but for small sites with good IA, bots can find all URL's without need for sitemap. However it's a good practice to have one to discover any potential issues.

3) Nothing wrong if you are already using html sitemap and all pages are getting crawled without issues.


5+ Year Member

Msg#: 4240087 posted 8:50 am on Jan 29, 2011 (gmt 0)

If you have a large website you can try GSiteCrawler (free) or A1 Sitemap Generator (commercial). If you just have a small website, and you just need standard XML sitemaps... Then any program/service will probably do :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved