Thursday 30 January 2014

Generate a sitemap automatically, does it need to be XML?

The simple answer is no, it doesn't have to be XML. It can be XML file, a text file or RSS/Atom feed (which is basically XML), HTML Sitemap
HTML Sitemaps These are used on your website to display the layout in layers on your website to any customer that would wish too (don't know why they would want too). These unfortunately are not suitable to submit to search engines
RSS Feeds These are rather useful for a feed of comments or articles on a blog, which are constantly updating, which in a sence is like an automatic sitemap of new content/comments on a blog.
XML Files These are in simple terms a set of links in XML format with aditional fields such as link and maybe a last modified field.
Text Files These used to be the prefered method of submitting to yahoo, however a while back they started accepting XML feeds.
  1. Can you create a site map with a .php extension Basically as long as your PHP file returns and XML header / mime-type and returns valid XML then you will be fine. Look at Wordpress, their RSS feeds are created using PHP.
Use the PHP DOM function and set your headers:
header( "content-type: application/xml; charset=UTF-8" );
$doc = new DomDocument('1.0', 'UTF-8');

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More