It says the date must be in RFC-3339 format which looks like this:
1985-04-12T23:20:50.52Z
From my research, PHP has predefined constants:
date(DATE_RFC3339);
date(DATE_ATOM);
I just can’t figure out how to display this format in Kirby.
I also have my atom feed setup at /feed, but it would be nice if I could have it work as /feed.atom. Is there a straightforward way to add the .atom extension at the end for this url?
Hm, I suspect you are using the date.handler option with the intl value, which then makes Kirby use PHP’s Intl extension for internationalized date formatting. This would explain why some parts of the date are formatted (with different values) and the backslash survives the formatting into the output.
You can either switch to the basic PHP date handler, or use the following format with intl:
The DateTimeInterface::W3C constant is defined like this:
public const string W3C = "Y-m-d\\TH:i:sP";
.atom extension in URL
I also have my atom feed setup at /feed, but it would be nice if I could have it work as /feed.atom. Is there a straightforward way to add the .atom extension at the end for this url?
On my own site I’ve implemented this by having a content/feed/feed.txt page, and then creating the following templates:
site/templates/feed.php ← not used but required!
site/templates/feed.json.php ← renders a JSON Feed
site/templates/feed.xml.php ← renders an Atom feed
The feed.php template is empty:
<?php
/**
* This template has to exist so that the content representation templates
* (feed.xml.php and feed.json.php) are used by Kirby.
* More info: https://getkirby.com/docs/guide/templates/content-representations
*/
Loading /feed.json will render the content/feed/feed.txt page with the site/templates/feed.json.php template.
Loading /feed.xml will render the content/feed/feed.txt page with the site/templates/feed.xml.php template. (I believe you could use any extension, so .atom instead of .xml might work too.)
Loading /feed will render the content/feed/feed.txt page with the site/templates/feed.php template, i.e. it will render a blank page. You could create a redirect in your site’s routes or even from the template itself to redirect to /feed.atom instead.
I think I’m using the default text/xml content-type for /feed.xml, but I could add some code to send a content-type: application/atom+xml header instead.