Add RSS feed to blog
This commit is contained in:
parent
d61fd44ed1
commit
f1496b0653
3 changed files with 43 additions and 0 deletions
|
@ -26,6 +26,8 @@ if( $page->isHomePage() ) {
|
|||
<meta name="robots" content="<?php echo $page->meta_robots()->html() ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="Janniks Blog" href="<?= site()->url() ?>?rss"/>
|
||||
|
||||
<?php echo css('assets/css/foundation.css?v1.1') ?>
|
||||
|
||||
<?php echo css('assets/css/main.css?v1.1') ?>
|
||||
|
|
33
site/snippets/blogfeed.php
Normal file
33
site/snippets/blogfeed.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
// -------------------------------------------
|
||||
// kirby snipper FOR generic
|
||||
|
||||
// copyright: Jannik Beyerstedt | https://jannikbeyerstedt.de
|
||||
// license: http://www.gnu.org/licenses/gpl-3.0.txt GPLv3 License
|
||||
|
||||
// Usage: snippet('blogfeed',["articles"=>$articles, "link"=>$baseurl, "feedurl"=>$feedurl])
|
||||
// -------------------------------------------
|
||||
|
||||
header("Content-Type: application/rss+xml");
|
||||
?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Janniks Blog</title>
|
||||
<description>Persönliches Blog von Jannik Beyerstedt</description>
|
||||
<link><?php echo $link ?></link>
|
||||
<atom:link href="<?= \Kirby\Toolkit\Xml::encode($feedurl) ?>" rel="self" type="application/rss+xml" />
|
||||
<pubDate><?php echo date("d M Y H:i:s O") ?></pubDate>
|
||||
|
||||
<?php foreach($articles as $a):?>
|
||||
<item>
|
||||
<title><?php echo \Kirby\Toolkit\Xml::encode($a->title()) ?></title>
|
||||
<link><?php echo \Kirby\Toolkit\Xml::encode($a->url()) ?></link>
|
||||
<guid isPermaLink="false">jbeyerstedt/<?php echo \Kirby\Toolkit\Xml::encode($a->slug()) ?></guid>
|
||||
<pubDate><?php echo $a->date()->toDate("d M Y H:i:s O") ?></pubDate>
|
||||
<description><![CDATA[<?php echo $a->text()->kirbytext() ?>]]></description>
|
||||
</item>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</channel>
|
||||
</rss>
|
Loading…
Add table
Add a link
Reference in a new issue