provide better ways to extend RSS feeds
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:
- Replace the
generateXmlFilesHooks and thegenerateNewsFeeds/generateCalendarFeedscronjobs with your own class and method. - Replace the
generateFeedonload_callbackfortl_news_feedandtl_calendar_feedwith your own class and method. - Use your own XML feed generation method, since Contao's
FeedandFeedItemclasses 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.
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.
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.
@leofeyer this issue was accidentally closed, since the wrong issue number was referenced in 877aaf7cb6768eb9c40081fc078202ebe2566ad1
@leofeyer what are you looking for help for?
@zonky2 help wanted means we are seeking for people outside the core team to provide a possible PR.
Closing this as #4682 provides more flexibility now.