I want to provide my blog with an rss feed for tags. I tried for 2 hours without any result. I woud appreciate any help.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
After three hours of trial and error I found a solution. All changes are done in BlogHolder.php
In the init() I chnged the link:
RSSFeed::linkToFeed($this->Link(). "rss/" .$this->ShowTag(), _t('BlogHolder.RSSFEED',"RSS feed of this blog"));
In the rss() I added a parameter to $entries:
$entries = $this->Entries(20, Director::urlParam('ID'));
The rss widget still works the same way. The browsers rss link in the address line is now dynamic and shows entries by the selected tag.
Now I just need a template link to rss.
Here is the template link to RSS:
function LinkToTagRSS() {
$url=$this->Link(). "rss/" .$this->ShowTag();
return $url;
}
Very simple ;) I hope I did not break a big security hole in my installation.
Hi!
That's a nice addition (BTW, did you submit it to Trac?), thank you!
Nevertheless, $LinkToTagRSS does not work in templates of widgets included in the Sidebar (i.e. SubscribeRSSWidget.ss and TagCloudWidget.ss). I don't know if it is a bug or a feature… ;)
Best regards,
Juan
Hi Juanitou,
I didn´t submit it to trac yet, mabe I finde some time tomorrow.
I´m not familiar with the widget arcitecture, but I know that those widget have their own controllers (eg RSSWidget.php). Maybe you have to implement the LinkToTagRSS-method there to call it on a widget template.
Greetings,
Roland