An even shorter version
Put this in your templates/sitemap.php
like before:
http://getkirby.com/blog/xmlsitemap
The route
c::set('routes', array(
array(
'pattern' => 'sitemap.xml',
'action' => function() {
tpl::load(kirby()->roots()->templates() . DS . 'sitemap.php', array( 'pages' => site()->pages() ), false );
}
),
));
That’s it.
- Now you don’t have to modify the template in any way.
- There is no need to redirect
/sitemap
because we don’t use the content method.
As a plugin
In case you want it as a plugin, just save the above code in /site/plugins/sitemap/sitemap.php
and change the first row to this:
kirby()->routes( array(