diff --git a/site/snippets/blog-htmlhead.php b/site/snippets/blog-htmlhead.php index a6aa516..b6f5e27 100644 --- a/site/snippets/blog-htmlhead.php +++ b/site/snippets/blog-htmlhead.php @@ -26,6 +26,8 @@ if( $page->isHomePage() ) { + + diff --git a/site/snippets/blogfeed.php b/site/snippets/blogfeed.php new file mode 100644 index 0000000..b476599 --- /dev/null +++ b/site/snippets/blogfeed.php @@ -0,0 +1,33 @@ +$articles, "link"=>$baseurl, "feedurl"=>$feedurl]) +// ------------------------------------------- + +header("Content-Type: application/rss+xml"); +?> + + + + Janniks Blog + Persönliches Blog von Jannik Beyerstedt + + + + + + + <?php echo \Kirby\Toolkit\Xml::encode($a->title()) ?> + url()) ?> + jbeyerstedt/slug()) ?> + date()->toDate("d M Y H:i:s O") ?> + text()->kirbytext() ?>]]> + + + + + diff --git a/site/templates/blog.php b/site/templates/blog.php index 1646d9f..8a4ba2f 100644 --- a/site/templates/blog.php +++ b/site/templates/blog.php @@ -25,9 +25,17 @@ function tags_html($base_url, $article) { $base_url = $site->find('blog')->url(); +$feed_url = $base_url.'?rss'; $articles = $page->children()->listed()->flip(); $title = $page->title()->html(); +// Deliver RSS feed on ?rss GET parameter +$is_rss = get('rss'); +if ($is_rss !== null) { + snippet('blogfeed', ["articles"=>$articles,"link"=>$base_url,"feedurl"=>$feed_url]); + exit; +} + // Filter by requested tag if($tag = param('tag')) { $articles = $articles->filterBy('tags', $tag, ',');