# News headline (RSS summary) behavior

**URL:** <https://www.ruby-forum.com/t/news-headline-rss-summary-behavior/101643>\
**Category:** Radiant CMS\
**Created:** [August 7, 2006, 12:48am UTC](https://www.ruby-forum.com/t/news-headline-rss-summary-behavior/101643 "2006-08-07T00:48:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [August 7, 2006, 12:48am UTC](https://www.ruby-forum.com/t/news-headline-rss-summary-behavior/101643/1 "2006-08-07T00:48:31Z")

</div>

I’ve just finished a first version of a simple news headline tag for  
Radiant, incorporated into a ‘News’ behavior. It parses an RSS feed from  
a given feed URL and generates an unordered list of headline items. The  
number of headlines and whether or not a published date gets appended  
can be configured through attributes. The behavior has been tested with  
the main article XML feed from a Typo 2.6.0 blog, an RForum 0.2 all  
forums post feed and a Collaboa 0.5.6 installation’s ticket feed.

[http://pond.org.uk/ruby/](http://pond.org.uk/ruby/)

Example:

\<r:news feed = “[http://mydomain.org/articles.xml](http://mydomain.org/articles.xml)”  
headlines = “3”  
dates = “1” /\>

Leads to something like:

- First news item (01-Aug-2006)
- Next headline (28-Jul-2006)
- Final RSS item title (19-Jul-2006)

The code requires the simple-rss gem. Unfortunately this does _not_ work  
with SlashDot’s news feed - the RSS parser doesn’t seem to understand  
it. RSS issues aside, it may have been better to have created tags that  
expressed the RSS contents directly and so provide greater content  
flexibility, though this would increase complexity for the user  
considerably. The existing behavior meets my immediate requirements, but  
if I find some spare time I may look into making a more generic RSS  
behavior too.

---

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [August 7, 2006, 3:46pm UTC](https://www.ruby-forum.com/t/news-headline-rss-summary-behavior/101643/2 "2006-08-07T15:46:18Z")

</div>

Andrew H. wrote:

> The code requires the simple-rss gem. Unfortunately this does _not_ work  
> with SlashDot’s news feed […]

Updated to use the core RSS parser, so the gem is no longer required.  
Problem with SlashDot fixed - tags are expanded before filters run; “~”  
characters in SlashDot URLs were being expanded into “”, breaking  
the HTML. Since there doesn’t seem to be a way to escape text to avoid  
Textile or Markdown processing, the “~” character is treated as a  
special case in links and expanded to “%7E” instead.

Same location as before:

[http://pond.org.uk/ruby](http://pond.org.uk/ruby)

---

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [August 7, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/news-headline-rss-summary-behavior/101643/3 "2006-08-07T16:40:52Z")

</div>

Yesterday, I wrote:

> […] it may have been better to have created tags that  
> expressed the RSS contents directly and so provide greater content  
> flexibility, though this would increase complexity […]

Someone else already wrote one. The threading got broken on the RForum  
interface so the two parts of the same discussion are separate there -  
see the following for details:

[Re: News headline (RSS summary) behavior - Radiant CMS - Ruby-Forum](http://www.ruby-forum.com/topic/76241)
