Welcome to WebmasterWorld Guest from 50.19.0.90

Forum Moderators: phranque

Message Too Old, No Replies

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

     
1:52 pm on Dec 8, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2001
posts:1436
votes: 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?
2:18 pm on Dec 8, 2010 (gmt 0)

Moderator from GB 

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

joined:Jan 30, 2002
posts:4842
votes: 1


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.

generate(); } } public function load() { global $dom; $dom = new DOMDocument; $dom->preserveWhiteSpace = true; $dom->loadXML(file_get_contents('Sitemap.xml')); } public function generate($flag) { global $categories,$dom,$urlset; $dom = new DOMDocument(); $dom->loadXML(' '); $urlset = $dom->getElementsByTagName('urlset')->item(0); // Example adding of home page $this->add_url(array('loc'=>'http://'.$_SERVER['SERVER_NAME'].'/')); // 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 $this->add_url($array); $dom->save('Sitemap.xml'); } public function add_url($vars) { global $dom,$urlset; if(!isset($urlset)) $urlset = $dom->getElementsByTagName('urlset')->item(0); $node = $dom->createElement('url'); $node->setAttribute('id',md5($vars['loc'])); foreach($vars as $key => $var) { $node2 = $dom->createElement($key); $node3 = $dom->createTextNode($var); $node2->appendChild($node3); $node->appendChild($node2); } $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()); $dom->save('Sitemap.xml'); } 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); if($row) $row->parentNode->removeChild($row); $dom->save('Sitemap.xml'); } } ?>
9:03 am on Dec 9, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 15, 2001
posts:1436
votes: 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.
12:00 pm on Dec 9, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member piatkow is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 5, 2006
posts:3284
votes: 12


I found a sitemap a benefit. For a small, reasonably static, site its easy enough to create in a standard text editor.
6:27 am on Dec 10, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 25, 2010
posts: 107
votes: 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.
8:50 am on Jan 29, 2011 (gmt 0)

New User

10+ Year Member

joined:Feb 7, 2006
posts: 29
votes: 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 :)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members