Created
August 15, 2012 22:07
-
-
Save simonscheiber/3364125 to your computer and use it in GitHub Desktop.
Kirby sitemap generator excluding invisible folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ignore = array('sitemap', 'error'); | |
// send the right header | |
header('Content-type: text/xml; charset="utf-8"'); | |
// echo the doctype | |
echo '<?xml version="1.0" encoding="utf-8"?>'; | |
?> | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
<?php foreach($pages->visible()->index() as $p): ?> | |
<?php if(in_array($p->uri(), $ignore)) continue ?> | |
<url> | |
<loc><?php echo html($p->url()) ?></loc> | |
<lastmod><?php echo $p->modified('c') ?></lastmod> | |
<priority><?php echo ($p->isHomePage()) ? 1 : number_format(0.5/$p->depth(), 1) ?></priority> | |
</url> | |
<?php endforeach ?> | |
</urlset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment