Tutorials

Sitemap.xml generation

Module by burny


Especially for new homepages a sitemap.xml file can be very helpful for indexing by search engines.
This tutorial will show you how to get a generated XML sitemap for your Kajona 3.3.1

Basically you can just put the contents of the attached zip file into your web root(the directory of your kajona installation, where index.php and .htaccess is, too).
The code shouldn't affect any existing templates etc.

If you enabled URL-rewriting, you have to modify the .htaccess file in the web root the following way:
1. After line 56, the RSS-Feed section, insert:
#sample sitemap.xml
RewriteRule ^sitemap.xml index.php?page=sitemap_xml [QSA,L]

2. If you enabled "skip all requests not ending with ..." around line 18, replace it with
# skip all requests not ending with .html, .rss or xml - they don't have any rewrite rules (little performance tweak)
RewriteRule !\.(html|rss|xml)$ - [L]

Next step:
Create a new page called sitemap_xml. Add a naviagation element, choose your main navigation (or any other if you like to) with type sitemap and sitemap_xml.tpl as template.
Now you should be able to access youre sitemap under /sitemap.xml

How it works:
I created a template named xml_file.tpl which contains the xml declaration and basically a navigation element.
Then I created a new navigation template named sitemap_xml.tpl which fills the Sitemap.xml schema. You can find it in templates/modul_navigation/sitemap_xml.tpl
Now the last step was to just create a new page called sitemap_xml with the xml_file template.
As a nice extra, the navigation class was modified so it now serves a lastmodified field.

For details, see http://board.kajona.de/viewtopic.php?f=43&t=1119&p=9184#p9173
Thanks to Stefan for his help!
Download

2 rates
102 downloads


Screenshots

Last update: 02/10/2011 16:50:05
File size: 6.75 KB

Comments

KajonaBase