Rss feed rendered like html

Hi, i’m using @bnomei plugin for generating a rss feed.

The plugin works great, but I can’t get why the output it’s rendered as html (see the image below), even if the source of the page is ok.

I’m sure I’m doing some incredible stupid mistake, but I can’t figure out which one…

image

please share your plugin version number and the code creating the response (route or template,…)

I downloaded the plugin just yesterday, so it must be the very latest version.

Here is the template code:

<? 

k3feed();


function k3feed()
{

  $items = hntData_trackList("feed", "", "", "", "", "", "", 0, 25, pages());

  $options = [
    'url'         => site()->home(),
    'title'       => 'Humans vs Robots - Ultime scoperte',
    'description' => 'Music discovery da HVSR.net',
    'link'        => site()->home(),
    'urlfield'    => 'url',
    'datefield'   => 'date',
    'textfield'   => 'text',
    'modified'    => time(),
    'enclosure'   => '',
    'comments'    => 'intro',
    'snippet'     => 'feed/rss', // or 'feed/json
  ];
  
  echo $items->feed($options);

}

Replace with <?php

It’s not recommended to use PHP short tags-

ok but nothing changes. Aside from that - why short tags are not reccomended?

Is there a cache you might have to clear?

Short tags: To PHP Short Tag or not to PHP Short Tag?

you are using it in a template not a route. the route would set the header to json when returning an array. i suggest you setup the route. if you must stick to the template you need to use kirbys header functions to change the mime to json. but i do not know by heart how to do so. maybe @texnixe can help you with that.

Instead of sending a header, you can use a content representation. Rename your template to feed.rss.php, your feed will then be accessible at your domain/feed.rss.

Or put this at the top of the file:

$kirby->response()->type('rss');
1 Like

Thanx @texnixe and @bnomei for your always top notch support!