Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » /page-not-found/ links in the RSS Feed

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1268 Views
  • Tama
    Avatar
    Community Member
    130 Posts

    [sitetree_link id=1773] links in the RSS Feed Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5503 Posts
  • Tama
    Avatar
    Community Member
    130 Posts

    Re: [sitetree_link id=1773] links in the RSS Feed Link to this post

    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)

    Attached Files
  • inCharge
    Avatar
    Community Member
    102 Posts

    Re: [sitetree_link id=1773] links in the RSS Feed Link to this post

    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();

       }

    }

    1268 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.