diff --git a/site/config/config.php b/site/config/config.php index 6add258..236cdb3 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -7,23 +7,27 @@ return [ 'compiler' => false ] ], - - // Bessere Scanner-Kompatibilität - 'cache' => [ - 'pages' => [ - 'active' => true + 'routes' => [ + [ + 'pattern' => 'sitemap.xml', + 'action' => function() { + $pages = site()->pages()->index(); + + // fetch the pages to ignore from the config settings, + // if nothing is set, we ignore the error page + $ignore = kirby()->option('sitemap.ignore', ['error']); + + $content = snippet('sitemap', compact('pages', 'ignore'), true); + + // return response with correct header type + return new Kirby\Cms\Response($content, 'application/xml'); + } + ], + [ + 'pattern' => 'sitemap', + 'action' => function() { + return go('sitemap.xml', 301); + } ] - ], - - // Headers für bessere Scanner-Kompatibilität - 'headers' => [ - 'X-Frame-Options' => 'SAMEORIGIN', - 'X-XSS-Protection' => '1; mode=block' - ], - - // Robots-freundliche Einstellungen - 'smartypants' => true, - 'markdown' => [ - 'extra' => true - ] + ], ]; diff --git a/site/snippets/sitemap.php b/site/snippets/sitemap.php new file mode 100644 index 0000000..9510636 --- /dev/null +++ b/site/snippets/sitemap.php @@ -0,0 +1,11 @@ +'; ?> + + + uri(), $ignore)) continue ?> + + url()) ?> + modified('c', 'date') ?> + isHomePage()) ? 1 : number_format(0.5 / $p->depth(), 1) ?> + + + \ No newline at end of file