WackoWiki : Dev/PatchesHacks/GoogleSitemapSupport

Google Sitemap Support


Google Sitemaps
Example Output
By Tann San 13th May 2006

This hack will allow you to generate a Google sitemap compatible XML file in a similar fashion to the recent changes XML file. It requires two additions to /classes/wacko.php.



The first is inside the SavePage function, find the first line and add the second:
$this->WriteRecentChangesXML();
$this->WriteGoogleSiteMapXML();


Further on in the file such as after the WriteRecentChangesXML function add the following:


The above will create an XML file called “sitemap-wackowiki.xml” inside the xml folder. You might want to change the path to output it in your root folder as that is now one of Googles requirements i.e. that the XML file is in the root folder.

The XML file will contain the last 100 modified pages although you can alter that value by changing 100 in the following line in the above function:


The XML itself will look like this:
<?xml version="1.0" encoding="windows-1251" ?> 
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
   <url>
      <loc>http://www.davidmillington.net/pages/PersonalProjects</loc> 
      <lastmod>2006-05-12</lastmod> 
      <changefreq>daily</changefreq> 
      <priority>0.8</priority> 
   </url>
</urlset>


XML Description