Skip to content

Commit f73820e

Browse files
committed
✨ add enclosure tag with image details to RSS feed, thanks @strukturart
1 parent b28d46e commit f73820e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

snippets/feed/rss.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<guid><?= \Kirby\Toolkit\Xml::encode($item->url()) ?></guid>
1616
<pubDate><?= $datefield === 'modified' ? $item->modified('r', 'date') : date('r', $item->{$datefield}()->toTimestamp()) ?></pubDate>
1717
<description><![CDATA[<?= $item->{$textfield}()->kirbytext() ?>]]></description>
18+
<?php $image = $images && $imagesfield ? $item->{$imagesfield}()->toFiles()->first() : null;
19+
if ($image): ?><enclosure url="<?= $image->url() ?>" length="<?= $image->size() ?>" type="<?= $image->mime() ?>" /><?php endif ?>
1820
</item>
1921
<?php } ?>
2022
</channel>

0 commit comments

Comments
 (0)