How do I get Kirby to render my feed as rss, not a webpage?

Hello there, our podcast is up and running, but when I try to access the rss feed directly (feed - Platten-Panorama), it is not rendered, e.g. like the sitemap (https://platten-panorama.de/sitemap).

I have a basic content file in “content/feed/feed.txt” with just a title.

No changed to the “config.php” are made.

The template “feed.php” has this:

<?php
header('Content-Type: application/rss+xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<rss version="2.0"
  xmlns:content="https://purl.org/rss/1.0/modules/content/"
  xmlns:wfw="https://wellformedweb.org/CommentAPI/"
  xmlns:rdf="https://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="https://purl.org/dc/elements/1.1/"
  xmlns:atom="https://www.w3.org/2005/Atom"
  xmlns:sy="https://purl.org/rss/1.0/modules/syndication/"
  xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  xmlns:itunes="https://www.itunes.com/dtds/podcast-1.0.dtd"
  xmlns:admin="https://webns.net/mvcb/"
  xmlns:podcast="https://podcastindex.org/namespace/1.0"
  xmlns:media="https://search.yahoo.com/mrss/">

<channel>
...
</channel>
</rss>

The page only renders like this, though:

Thanks for support <3

This looks like it would be the error page of your site. Which means Kirby cannot find the matching page for /feed. Are you 100% sure it’s in ``content/feed/feed.txt`?

you might need to add a site/blueprints/pages/feed.yml even if its empty all but the title. kirby maps blueprints to templates not the other way round.

site/blueprints/pages/feed.yml

title: Feed

yes, 100% sure.

thanks, I added that - did not help unfortunately…

Any custom routes or plugins installed?

It is not the 404 page that is being rendered. My guess is a regular page but the block fields not being adressed correctly.

I also tried the following in the meantime, unfortunately without success:

a) Defining additional routes in “config.php”

  'routes' => [
    [
      'pattern' => 'feed.xml',
      'action'  => function() {
        return page('feed')->render(['template' => 'feed.xml']);
      }
    ]
  ],

b) Changing the route to the following to test if anything at all changes - result: line “Custom route loaded” does get rendered

  'routes' => [
    [
      'pattern' => 'feed',
      'action'  => function() {
        return 'Custom route loaded';
      }
    ]
  ],

c) Empty the cache folder

d) changing the feed folder/template name (which would be the worst solution because all podcaterchers know the feed url)

“themesforkirby” is installed as a plugin. This includes the custom route

 'routes' => [
    [
      'pattern' => 'sitemap.xml',
      'action'  => function() {
        $pages = site()->pages()->index();

        // Fetch the pages to ignore
        $ignore = kirby()->option('sitemap.ignore', ['error', 's']);

        $content = snippet('sitemap', compact('pages', 'ignore'), true);

        // Return response with correct header type
        return new Kirby\Cms\Response($content, 'application/xml');
      }
    ],
    [
      'pattern' => 'sitemap',
      'action'  => function() {
        return go('sitemap.xml', 301);
      }
    ]
  ],

I think I found it :muscle:

I was really sure everything was fine for months. Yesterday I changed the image file from png to a jpg - manually via FTP. After changing “platten-panorama-der-musikpodcast.png” to “platten-panorama-der-musikpodcast.jpg” everything seems up and running again :heart_eyes:

My hunch why this was the issue: Could it be that you also have a platten-panorama-der-musikpodcast.jpg.txt in the same folder? When you changed the image file to .png via FTP, this text file would not have a matching media file anymore and so Kirby would have the platten-panorama-der-musikpodcast.jpg.txt and feed.txt as potential main content files - without a clear indication which one to use for content, template etc.

Exactly, that’s what I meant yesterday, was a bit late in the afternoon :wink:
I needed to change the text file accordingly from “platten-panorama-der-musikpodcast.png.txt” to “platten-panorama-der-musikpodcast.jpg.txt” and then it worked… Thank you guys very much!