21287 Posts in 5733 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1045 Views |
-
[sitetree_link id=1773] links in the RSS Feed

31 March 2011 at 9:59am
Morning
If a user subscribes to our RSS Feed (www.tasman.govt.nz/home/rss) the links in the RSS items appear as "http://www.tasman.govt.nz/[sitetree_link id=1773]" which means if the user clicks through on an in-item link they get a 404 page with the following URL: http://www.tasman.govt.nz/%5bsitetree_link%20id=1773%5d
How easy is it to achieve either of the following:
1.) Use a URL rewrite to redirect the sitetree_link to the correct page. Is there a native PURL format in Silverstripe? i.e. www.tasman.govt.nz/page/1773
2.) Rewrite the links during the RSS generation so they contain the current URL.
Cheers
Tama -
Re: [sitetree_link id=1773] links in the RSS Feed

31 March 2011 at 6:54pm
Hi Tama, See my post (http://silverstripe.org/general-questions/show/16384#post301296) for an explanation.
-
Re: [sitetree_link id=1773] links in the RSS Feed

1 April 2011 at 4:54pm
Thanks Will, much appreciated.
As I side note I noticed your Silverstripe tries to parse the sitetree_link in my thread title in the HTML page <title> and breadcrumb (see attached screenshot)
-
Re: [sitetree_link id=1773] links in the RSS Feed

14 July 2011 at 8:24pm
Thanks Will, and thanks Tama for putting your finger on the problem.
Some woking code using Will's tip...
class ArticlePage extends Page {
.
.
.
function RssContent() {
// Pass the Content field to the RSS feed, so shortcodes are processed
return DBField::create('HTMLText', $this->Content);
}
}
class ArticleHolder_Controller extends Page_Controller {
function rss() {
$rss = new RSSFeed(
$this->Children()
, $this->Link()
, 'Latest news'
, null
, 'Title'
, 'RssContent' // Tell the RSS feed which field to use to retrieve Content
);$rss->outputToBrowser();
}
public function init() {
RSSFeed::linkToFeed($this->Link() . "rss");
return parent::init();
}
}
| 1045 Views | ||
|
Page:
1
|
Go to Top |


