RSS2 feed: Possible improvements

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

RSS2 feed: Possible improvements

Post by johncanary »

Hi developers, hi everyone!

I have the following suggestions from playing around with the RSS Feeds and checking several S9Y 1.3.1. blogs
against http://validator.w3.org/feed/ and www.feedvalidator.org (not working properly today).
I keep it short and sweet. Most important (probably) things first.

The RSS2 Content Feed validates OK, but the tool gives recommendations for
improving the interoperability.

Code: Select all

E.g.      line 45, column 4: Ensure description precedes content:encoded
                         (15 occurrences) [help]
              <content:encoded>
              ^
The <description> entity in <item> is used by several services that operate on
RSS feeds as input
. Some seem to ignore the <content:encoded> totally.

A <description> could be introduced via the feed_2.0.tpl template easily.
For example it could be filled with the $entry.body content or just the first
200 characters of it.
  • Is there a Smarty function for converting html2text?
    Just found the solution in this thread: Stripping HTML tags from {$entry.body}

    Code: Select all

    {if !empty($entry.body)}
        <description>
         {$entry.feed_body|strip_tags:false|truncate:200:"...":false|@escape}
         </description>
        <content:encoded>
        {$entry.feed_body|@escape} {$entry.feed_ext|@escape}
        </content:encoded>
    {/if}
    'Smarty' is really great.
Wordpress uses the Excerpt field (or a fixed length of the text) to fill the
description, they don't do HTML escape, they note it as <![CDATA[ ... ]]>
(I am sure you know.)

  • Could I use the Extended Properties Plugin to introduce a sort of Excerpt
    field to entries/posts and grab that in the template?

    (From what I have checked out. I think so.)

Next issues:

Code: Select all

E.g.      line 24, column 63: Image title doesn't match channel title [help]

Channel Title: <title>Serendipity</title>
Image Title:   <title>RSS: Serendipity - The official Serendipity blog</title>

optionally it throws in the (Login as: Admin) in the image title
Can be fixed in ./includes/functions_plugin_internal.inc.php where
$metadata.additional_fields.image is created or where ever $metadata.title
is prepared.


Code: Select all

E.g.  line 114, column 0: Ensure lastBuildDate is present when slash:comments
                       is used (15 occurrences) [help]
I guess they refer to <channel><lastBuildDate>...</lastBuildDate></channel>

Code: Select all

E.g.      line 591, column 0: Missing atom:link with rel="self" [help]
          </channel>
That can be added to the template easily.

Last but not least would be nice to have a <Copyright> entity in the
Channel, which can be configured in the Admin Panel.
(I actually have patched that but only for S9Y 1.1.2 so far...)

Yours
JohnCanary

P.S.: I have reported a time-offset issue in the bug section:
Wrong <pubDate> in RSS Feed, TimeOffset != 0
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: RSS2 feed: Possible improvements

Post by garvinhicking »

Hi!

We've had this topic a couple of times before; maybe one can look it up here. The ghist of it was that <description> is not allowed to contain HTML markup, only plaintext. which is why we use content:encoded instead, but I don't understadn why validators dislike this (since it works properly everywherhe?!)

And yes, you could create your own custom field to use inside the RSS template.

Do you find a place in the RSS spec where it says the image title must match the channel title? I see no reason why it should?

I'd appreciate the other changes to the feeds...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
johncanary
Regular
Posts: 116
Joined: Mon Aug 20, 2007 4:00 am
Location: Spain
Contact:

Re: RSS2 feed: Possible improvements

Post by johncanary »

Hello Garvin!

Right <description> needs plain text, just like an excerpt, but it's a
mandatory field. I'll feed it like in the example above via the Smarty
functions and will use a custom field for a real excerpt (optional) with
that great extended properties plugin.

The spec doesn't say anything about the value of <image><title> only
that it's used as ALT text for the <img> icon. The recommendation for
the same text as <channel><title> might come from usability issues
with visually impaired users.

<contend:encoded> works fine. I mean look at the feed through
Google reader or feedburner. No complains from there.

Thanks for the quick reply.
Yours John
: John's Google+ Profile
: John's E-Biz Booster Blog powered by Serendipity 1.7/PHP 5.3.14
tpost
Regular
Posts: 77
Joined: Fri Sep 21, 2007 1:45 am

Post by tpost »

Hi guys,

I'm just looking at the RSS 2.0 specs as well and was wondering what variable one would need to use if we wanted the <lastBuildDate> attribute displayed? Would this need to be added in S9Y root "rss.php"? or the feed template?


I think that by default, the <content:encoded> tag should be parsed as CDATA, as Feedburner automatically converts a S9Y <content:encoded> tag with CDATA. Are there any negatives by doing so?

Thanks for reading!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Serendipity creates the files dynamically on request, so a <lastBuildDate> does not really apply here. You could use the timestamp of the last published entry though, which is inside the {$last_modified} smarty variable.
I think that by default, the <content:encoded> tag should be parsed as CDATA, as Feedburner automatically converts a S9Y <content:encoded> tag with CDATA. Are there any negatives by doing so?
Yes, there are clients that do not properly evaluate CDATA. Since content:encoded already per definition contains CDATA, using it again might not be the most compatible way for all readers and aggregators out there...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply