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
- <loc> – location of the page
- <lastmod> – last date the file was modified
- <changefreq> – frequency that the file is modified, valid values are daily, monthly and yearly. In the function this is calculated based on the last time the file was changed so if it was less than 30 days ago it gets set to daily. If it was over 30 days ago but less than 60 days ago it gets set to monthly and anything over that gets set to yearly
- <priority> – how you rate this page (i think), this is always set to 0.8 in the function as I couldnt decide on a nice way to dynamically calculate it