Add image from Files to description in RSS (using kirby3-feed)

I’ve added Bruno Meilick’s kirby3-feed plugin to my webcomic site using the Virtual Page configuration option, and it works great. I’m pulling the feed items directly from a collection that contains a filtered set of content from my site, and the feed is showing the item titles which, when clicked, redirect correctly to the relevant page on the site.

Here’s what the configuration file looks like:

<?php

return [
    'debug' => true,
    'routes' => [
        [
            'pattern' => 'feed',
            'method' => 'GET',
            'action'  => function () {
                $options = [
                    'title'       => 'Latest Comics',
                    'description' => 'Read the latest Skeleton Crew comics',
                    'link'        => 'comic',
                    'description'   => '', // comic image should go here
                ];
            
                $feed = collection("all-comics")->feed($options);
                return $feed;
            }
        ]
    ]
];

Each item in the feed is a comic strip, so I’d like to use the comic image as the description for each RSS entry. This is how I access the images currently:

$page()->files()->findBy('template', 'main-image');

Does anyone know how I might achieve that in the format that the virtual page configuration can parse?

hi @Mike_Armstrong. the rss item description is generated based on the textfield option.

for virtual pages you can extend your model to provide the text() method or create a new one like rssDescWithImg() and set 'textfield'=>'rssDescWithImg' in the config.

maybe the method must return a field-object so the rss snippet can invoke ->kirbytext() on it. but i never tested this.

Thanks for the advice. I’ve rolled my own solution for now, but will try and get this working at a later date.