Tuesday, September 8, 2009

Truncating Feed Item Description without affecting HTML design



In my previous post, I have explained about Yahoo Pipes for combining multiple RSS feeds into one single feed in desired way.

Today, while improving our Tamil News, I was required to limit the number of characters in the description of the feed items.

The feed item description will be having HTML tags also. So blindly truncating the description after specified amount of characters will spoil the look and feel of the description.

To handle this scenario we can use RegEx module (Regular Expression) of the Yahoo pipe.

We need to fill the RegEx module as below.

In -item.description
replace-(?s)^(([^<]|<[^>]+>){400})(?(?<!\b)([^\b]*?)\b).*
with-$1$3



More Articles...

No comments:



Thanks for visiting our blog


twitterrss facebook linkedin YouTube subscribe


Subscribe via email

Enter your email address: