RSS-Plugin - Coverimage in RSS-Feed?

Hi Dennis,

here is an example with an image

https://forum.getkirby.com/t/rss-feed-with-images/1835/5?u=texnixe

Instead of the foreach loop which goes through all the site files, you can fetch a single image here instead.

The adapted code would then look like this:

Fetch the first image in the folder:

<?php  if($image = $item->images()->first()): ?>
  <figure>
    <a href="<?php echo $image->url() ?>">
    <img src="<?php echo $image->url() ?>">
    </a>
  </figure>
<?php endif ?>

Or, if you want to fetch an image from a coverimage field:

<?php  if($image = $item->coverimage()->toFile()): ?>
  <figure>
    <a href="<?php echo $image->url() ?>">
    <img src="<?php echo $image->url() ?>">
    </a>
  </figure>
<?php endif ?>

Adapt to use your field name.

3 Likes