Which date field/format to use for a route rss?


I’m creating an rss feed using the route mentioned earlier in this forum. The feed seems to work well, but has problems getting the date from the posts (and therefore sorting the feed by date).




'pattern' => 'rss',
'action' => function(){
  $output = page('home')->children()->visible()->filterBy('pub_date','<=',date('Y-m-d'))->sortBy('pub_date','desc')->limit(10)->feed(array(
    'title'       => 'Tap to Play!',
'description' => '',
'link'        => '',
'datefield'   => 'pub_date',
'textfield'   => 'text'
  $r = new Response($output, 'xml', 200);
  return $r;

All posts use a field “Date” filled in that format:

Date: 04 August 2013

I tried changing “pub_date” to “Date” but that only results in the generic kirby error message. I think I’m using the wrong field or it does not like the date format in the field.

Do you have any ideas?


If your field is called date and not pub_date, then you have to use the date field.
Please enable debugging in your config.

c::set('debug', true);

to get information about the error.

This should be:

filterBy('date','<=', time())

so that we compare the date field to a Unix timestamp.


filterBy('date','<=', strtotime(date('Y-m-d')))

Hello texnixe,

thanks for you answer. I really appreciate it!

Some more information:

Both the feed template (feed plugin 2.0.0) and the route do work in Kirby 2.1.1 (bundled with the theme) and errors get logged.

When I update (with replacing the kirby and panel folders with folders from the starter kit) to the current release the feed template and route stop working and also errors do no longer get logged. I use an identical configuration file (site/config/config.php) and the htaccess file has only one difference in the RewriteBase setting.

As a next step I will try to check at which version it breaks and also directly use the version from git and not the starter kit as a zipfile. Maybe something’s different.

I’m currently more bothered with the missing error messages than with the broken feed, because error messages might help me ;).

It would be great if the developers could update their theme to the latest Kirby version if they are still selling it… and then they should also support it. But the site looks a bit abandoned with its broken dribble showreel.

Well, they do reply to my mails ;).

As far as I see it, the rss route variant should only require the route definition and the feed plugin? Then I could test it in other themes and the starter kit (so far, every other free blog theme does not come with an rss feed out of the box).

Check out the baseblog theme: https://github.com/sashtown/baseblog It’s currently on 2.5.9 and should be updated to 2.5.10, but that shouldn’t be such a big issue. It uses a content file instead of a route, but you should be able to easily slip in the route instead.