Created
April 23, 2014 16:31
-
-
Save DerZyklop/11222482 to your computer and use it in GitHub Desktop.
A xmlsitemap for Kirby CMS without listing the children of "kontakt"
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'); | |
foreach ($pages->find('kontakt')->children() as $value) { | |
array_push($ignore, $value->uri()); | |
} | |
// 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->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