Help with creating an rss feed to submit to Apple news

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 6, 2016   (RSS)

By JeffC - July 1, 2016

I've had some feedback from Apple. Apple suggested I use the W3C Validator to check my feed. This is what I found.

1. Permalinks may be causing an issue. guid must be a full URL, unless isPermaLink attribute is false:
It sounds like I have two options here: use a full URL or set isPermaLink to false: as my main site uses permalinks, my guess is that is should be left as True so I have added the prefix to the permalink 

ie change this:

<guid isPermaLink="true">/sectionname/permalink/</guid>

to this:

<guid isPermaLink="true">http://domain.co.uk//sectionname/permalink/</guid>

2. Line-breaks and returns at the end of a text field cause problems: Undefined title element: br
When a user creates a record they often inadvertently leave a carriage return at the end of the line. Probably most common when a user is copying from a word.doc and the like. 

Deleting the <br> from the title field fixed the error. I had to manually delete loads of <br> tags though. Educating the user to check for them before posting would be a solution - not sure how practical that would be though!

Perhaps a solution would be to develop a plugin that shows invisible characters on certain field? A user would be much more include to delete something that they can actually see

I have made the above changes and my feed now validates. I have uploaded it to Apple and will post my results here. (May take a few weeks)

Jeff

By Daryl - July 6, 2016

Hi Jeffncou,

Thanks for sharing your solution.

I did some research and found out that GUID doesn't necessarily need to be a permalink. 
According to the following documentation, it is used as unique identifier where an aggregator may use to determine if an item is new.
https://validator.w3.org/feed/docs/rss2.html#ltguidgtSubelementOfLtitemgt

If we need to add a link to an item, we can use the <link> tag which the code generator already adds to the code: 
http://www.rssboard.org/rss-profile#element-channel-item-link

I will discuss this with our senior programmer if we should update the code generator to set the "isPermaLink" attribute to false by default.

For the <br> tags in the title element, you can use strip_tags function to remove it. ie:

strip_tags($title, '<br>');

There's no easy way to check for it when a user creates a record.

But a plugin that is hooked to "record_presave" plugin hook is one way to check for <br> tags before saving a record.

Please let me know if you have any questions and let us know the results from Apple.

Thanks,

Daryl Maximo
PHP Programmer - interactivetools.com