Limiting RSS Feed

perrie
@perrie
7 years ago
435 posts
I have been using JR RSS feed to bring more attention to my most active groups. But the feed is giving me a the full article. How do I limit the feed to just the title and a blurb?
updated by @perrie: 04/30/17 11:24:48PM
Dazed
Dazed
@dazed
7 years ago
1,022 posts
@perrie I am not 100% sure but this should help. The below was an rss loop I had in an old skin. Based on the loop you should be able to use the "|truncate:# of letters:" as shown below.

                {foreach from=$jrFeed.feed.item item="item"}
                    <div class="normal">
                        <a href="{$item.link}">{$item.title}</a><br>
                        {$item.pubDate|jrCore_date_format}<br>
                        {$item.description|truncate:20:"...":false}<br>
                    </div>
                    <hr>
                {/foreach}


perrie
@perrie
7 years ago
435 posts
Thanks Daze,
I just tried putting that into template code and the RSS stopped working. Is there somewhere else I should be putting it?
updated by @perrie: 01/02/17 01:03:21PM
Dazed
Dazed
@dazed
7 years ago
1,022 posts
Do not put the whole piece of code in. Just look for the rss call and add the |truncate:20:"...":false} as shown in the above.
perrie
@perrie
7 years ago
435 posts
Dazed, still not working. Should I be putting the name of the feed in where it says "item"?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
post your code for that
alt=
K_K
@k-k
7 years ago
95 posts
I tried the truncate code
|truncate:20:"...":false
from above post for my rss feed, but it would not shorten the text.

Anyone else with better luck?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
I was looking for the full code. :) This should work though. If the call is pulling something like $_item.row.description or $item.rss.text (no idea what the variable is here that is pulling the text) then changing it to the below should work since it limits the output. The ellipses could be a link to the full story or you could just link off the title.
{$_item.row.description|truncate:20:"...":false}
{$item.rss.text|truncate:20:"...":false}

updated by @dazed: 01/03/17 05:51:57AM
alt=
K_K
@k-k
7 years ago
95 posts
Thanks, I try that.
perrie
@perrie
7 years ago
435 posts
OK I must be not understanding something.
I put that code into the template code area, and the RSS feed fails.
I am not very techy, so maybe I am missing something.

So when you write:
{$_item.row.description|truncate:20:"...":false}
{$item.rss.text|truncate:20:"...":false}

Should I be filling in something?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
you need to append it to the existing code. You should see something like:

{$item.rss.text}

change to

{$item.rss.text|truncate:20:"...":false}
perrie
@perrie
7 years ago
435 posts
OK I am attaching what I am looking at. Maybe I am looking at the wrong template?
Dazed
Dazed
@dazed
7 years ago
1,022 posts
Exactly
perrie
@perrie
7 years ago
435 posts
OK so I put this code:
{$item_description|jrCore_strip_html|truncate:20}
on line 14 of the code I included and nothing happened.

Not sure why...
perrie
@perrie
7 years ago
435 posts
OK kind of got it to work, but I now lost all of the description.