bnomei / kirby3-feed

Generate a RSS/JSON-Feed and Sitemap from a Pages-Collection.
https://forum.getkirby.com/t/kirby3-feed-rss-json-sitemap/23574
MIT License
62 stars 7 forks source link

Template says Atom, but is actually RSS standard based #60

Open dewey opened 2 months ago

dewey commented 2 months ago

Hey, thanks for the plugin, I'm just setting it up for my Kirby blog. While porting my existing feed to Kirby I noticed that right now the rss.php snippet uses <guid> as the unique identifier of an entry. I believe this should be <id> according to the Atom spec, which is set as the content type here. The <guid> element is from the RSS standard, not Atom.

There's some other fields too that are not from the Atom standard like the <link> element which should be in the following format: <link href="http://example.org/2003/12/13/atom03"/>, same for pubDate which is <published>2003-12-13T09:17:51-08:00</published> in Atom.

Edit: When I reported this first I thought it's just the guid / id issue but then realized the whole template is actually wrong. Maybe it would be best to change the content type there to be RSS and add a second atom.php template?

bnomei commented 3 weeks ago

hi @dewey

thanks for reporting the issue. adding a seperate atom template seems to be the best choice indeed. i will try to get it done asap.

bnomei commented 3 weeks ago

@dewey can you test again with v.1.7.0? thanks

bnomei commented 3 weeks ago

i added a feed/atomsnippet

dewey commented 3 weeks ago

Thank you, I'll test it in two weeks when I'm back on my computer!

dewey commented 5 days ago

Hey @bnomei—

I took a look and there seems to be a small issue:

[Thu Sep  5 20:57:26 2024] TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /Users/philipp/repos/github.com/dewey/blog.notmyhostna.me/site/plugins/kirby3-feed/snippets/feed/atom.php:5
Stack trace:
#0 /Users/philipp/repos/github.com/dewey/blog.notmyhostna.me/site/plugins/kirby3-feed/snippets/feed/atom.php(5): date('r', 'Fri, 30 Aug 202...')

I'm not sure where it's coming from as $modified should be an int already?

Screenshot 2024-09-05 at 21 17 07 png@2x

Additionally I think what would be great:

1) What do you think about adding an <author> element?

2) Having the original published timestamp, not just the updated timestamp:

<published><?= $item->date()->toDate('c') ?></published>

3) It would be nice to have a Content section not just a summary one, for feeds that have the full text of the blog post. In my case I did that with:

      <content type="html" xml:lang="en">
        <![CDATA[<?= $item->blocks()->toBlocks() ?>]]>
      </content>

Let me know what you think!