Custom fields and elements
You can add your own XML elements to a feed: article custom fields on each item, fixed elements on the channel, and the namespaces they need.
Article custom fields on each item
On the Joomla articles source, Extend with Custom Fields adds Joomla custom field values to every item.
- Edit the feed and open the Data Source tab.
- Under Extend with Custom Fields, click +.
- In Title, type the element name, such as
priceorg:price. - In Value, pick the custom field.
- Add a row for each field and save.
Each item then gets <price><![CDATA[...]]></price> with the article's field value. A name with a prefix, such as g:price, needs that prefix declared in Custom Namespaces, or the element is skipped so the feed stays valid.
To cut a long field value, add its element name to Tags to Limit. See Text, HTML and images.
Custom namespaces
Custom Namespaces on the Feed Options tab declares extra XML namespaces on the feed. Enter one per line:
g||http://base.google.com/ns/1.0
nb||https://www.newsbreak.com/
A namespace the format already declares, such as media or itunes, is not declared twice.
Channel elements
Custom Elements on the iTunes Podcast tab adds fixed elements to the channel of PODCAST ITUNES and MRSS feeds. Enter one per line as name||value, for example itunes:new-feed-url||https://example.com/podcast.feed.
For developers: the onJoomrssPrepareFeedItem event
To add elements in code, write a system plugin that listens to onJoomrssPrepareFeedItem. JoomRSS fires it for every item before it is written, so your code survives JoomRSS updates.
The event arguments are:
| Argument | Content |
|---|---|
item |
The feed item. Add elements to $item->additionalElements as name => value. |
row |
The source row, such as the article. |
config |
The feed's item settings. |
feed |
The feed. Register each prefix you use on $feed->namespaces as prefix => uri. |
feedType |
The format, such as RSS20 or ATOM. |
adapter |
The data source name, such as content. |
An element whose prefix is not declared is dropped, so the feed stays well-formed.