RSS feeds summary only - trim full post (while aggregating)
public
group: RSS & Aggregation
vkr11 - Wed, 2008-06-25 00:08
I am aggregating Feeds from various site to aggregate at my site. Many of these feeds provide complete post instead of just a summary/teaser. I would like to aggregate only the teasers of these feeds (instead of the complete feed), and let the users go to the complete feed if required.
Is there a way for me to show summary only? At the moment, if the feed it aggregate is a full feed, it will show the full thing as well. I want to trim down the aggregated content, say to only 250 characters.
Thanks,
Victor


Create a view showing the
Create a view showing the content and select to only show the teaser not the full post.
Kyle Mathews
The feeds that I have is
The feeds that I have is coming from other sites (and not generated at my site). I am using feedapi to aggregate them, so can not really use it with views?
You can use views if you set
You can use views if you set FeedAPI to create nodes instead of the light-weight feeditems.
Kyle Mathews
truncate_utf8
I like this function for this kind of thing: http://api.drupal.org/api/function/truncate_utf8/5
When used for shortening feeds, I've used it like
<?phpprint truncate_utf8(strip_tags($body), 200, TRUE, TRUE);
?>
That should remove any html tags, crop the body to 200 characters, breaking at a word space, and adding '...' at the end.
Zivtech | Illuminating Technology
I did not know that this
I did not know that this function exists, so far I wrote my own functions to do this. Drupal is always good for a positive surprise.
--
Websites: SEO-Expert-Blog.com | Torlaune.de
Is there a way to achieve
Is there a way to achieve this without getting into the PHP programming? If not where should I be adding this piece of code?
Important Topic
I really think this is an important topic. I'm currently using the FeedAPI 6.x-1.x-dev (2008-Sep-18).
One of the things that has always bothered me about aggregation in Drupal is the potential of running into copyright issues when inadvertently displaying the full contents of the feed's original post. There certainly are times when you want to display only the teaser or change the teaser length (and body) of your feed-items to something different from your site's default teaser.
For those using FeedAPI and by taking Lynn's step a little further you can make some minor changes in the FeedAPI's feedapi_node.module. Near line 303 in the function_feedapi_node_save you'll find:
$node->body = $feed_item->description;$node->teaser = node_teaser($feed_item->description);
in which I changed to:
$node->body = truncate_utf8(strip_tags($feed_item->description), 400, TRUE, TRUE);$node->teaser = truncate_utf8(strip_tags($feed_item->description), 200, TRUE, TRUE);
If you're perfectly fine with your default teaser but wish no have the body the same as the teaser, you may want to try:
$node->body = node_teaser($feed_item->description);$node->teaser = node_teaser($feed_item->description);
If there is an easer way to do this using CCK and/or Views...please let me and others know. Either way, I sure wouldn't mind a feature in Drupal's aggregation that allowed you to reduce the body to a size of your own choosing. What do others think?
BryanSD
CMS Report