core-bundle icon indicating copy to clipboard operation
core-bundle copied to clipboard

provide better ways to extend RSS feeds

Open fritzmg opened this issue 8 years ago • 5 comments

Current state

Currently if you want to extend the RSS feeds provided by the news-bundle or calendar-bundle with additional data, you would have to do the following steps (more or less), if you still want to provide Contao's functionality of creating the RSS feeds in the back end:

  1. Replace the generateXmlFiles Hooks and the generateNewsFeeds/generateCalendarFeeds cronjobs with your own class and method.
  2. Replace the generateFeed onload_callback for tl_news_feed and tl_calendar_feed with your own class and method.
  3. Use your own XML feed generation method, since Contao's Feed and FeedItem classes are limited.

This is cumbersome and would not work if more than one extension wants to add more items to the feeds.

Use Cases

Facebook Instant Articles

When using an RSS feed for Facebook Instant Articles, your RSS feed items must contain a <content:encoded> element with the required markup of the detailed content of your news item. This requires the support of your RSS library to create such an element and the <rss> header needs to be expanded with xmlns:content="http://purl.org/rss/1.0/modules/content/".

Adding locations to events

You might want to add the location of your event to the RSS feed. There is an event namespace draft for RSS which includes a location item: http://web.resource.org/rss/1.0/modules/event/

Possible implementation

The Feed class would need support for any namespace (or at least any existing namespace) and the FeedItem class would need support to add any elements from such namespaces. The FeedWriter library for example supports these namespaces automatically. Before creating the <rss> header, it processes each feed item and then adds the necessary namespace declarations automatically.

Then the existing generateFiles methods could add simple hooks so that the $objFeed and $objItem objects can be altered.

fritzmg avatar Dec 18 '17 11:12 fritzmg

I think we should move away from our implementation in general. I'm using debril/rss-atom-bundle in one of my projects which is a way better implementation, it also uses the reverse proxy cache instead of writing random files to the file system.

aschempp avatar Jan 15 '18 14:01 aschempp

Definitely need improvement here. Being able to edit templates would help a lot. I would also prefer to have just one format [atom|rss] that is a bit more flexible than two which aren't.

asaage avatar Aug 14 '18 14:08 asaage

@leofeyer this issue was accidentally closed, since the wrong issue number was referenced in 877aaf7cb6768eb9c40081fc078202ebe2566ad1

fritzmg avatar Feb 18 '20 17:02 fritzmg

@leofeyer what are you looking for help for?

zonky2 avatar Dec 13 '21 15:12 zonky2

@zonky2 help wanted means we are seeking for people outside the core team to provide a possible PR.

fritzmg avatar Dec 13 '21 16:12 fritzmg

Closing this as #4682 provides more flexibility now.

fritzmg avatar Oct 17 '22 22:10 fritzmg