I have two rss feeds on my website. One of them use @bnomei RSS feed plugin and the other one is a custom implementation for my podcasts. They both finish in /feed.
Each time I access the urls, instead of showing me the page with the content of the xml file, a file named “feed” is available to download. If I download it and open it, the file is perfectly fine. I thought it was a server thing but apparently no.
I tried using $kirby->response()->type('rss');
in my template but it didn’t change anything. I’m using the latest version of kirby.
Here’s my feed.php template file :
<?php
$kirby->response()->type('rss');
$language = $kirby->language();
$options = [
'en' => [
'url' => site()->url(),
'feedurl' => site()->url() . '/feed/',
'title' => 'Latest articles',
'description' => 'Read the latest news about our company',
'link' => site()->url(),
'urlfield' => 'url',
'titlefield' => 'title',
'datefield' => 'date',
'textfield' => 'text',
'modified' => time(),
'snippet' => 'feed/rss', // 'feed/json'
'mime' => null,
'sort' => true,
],
'fr' => [
'url' => site()->url(),
'feedurl' => site()->url() . '/feed/',
'title' => 'Derniers articles',
'description' => 'Nos dernières publications',
'link' => site()->url(),
'urlfield' => 'url',
'titlefield' => 'title',
'datefield' => 'date',
'textfield' => 'text',
'modified' => time(),
'snippet' => 'feed/rss', // 'feed/json'
'mime' => null,
'sort' => true,
],
];
$frContent = page(['articles', 'podcasts']);
$enContent = page('articles');
$feedContent;
if($language == "fr") {
$feedContent = $frContent;
} else {
$feedContent = $enContent;
}
$feed = $feedContent
->children()
->listed()
->filter(function ($page) use($language) {
return $page->translation($language->code())->exists();
})
->sortBy(function ($page) {
return $page->date()->toDate();
}, 'desc')
->feed($options[$language->code()]);
echo $feed;
?>
Any tips on how to get this working?
Edit: on Firefox it gives me the file to download, on chromium the page is shown as text.