Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Unique id for articles for Google News.

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1430 Views
  • ScottiouS
    Community Member
    54 Posts

    Unique id for articles for Google News. Link to this post

    Although I love the fact that Silverstripe creates SEF URL's I needed to include a unique ID for each article created by the system. This is pretty easy to do by just adding the following function into the ArticlePage.php under the ArticlePage class:

       function newLink() {
          return $this->Link() . '00' . $this->ID;

    You can now access the variable $newLink in the ArticleHolder.ss and the ArticlePage.ss which will point to your articles with an id number suffix.

    Eg. and article that is normally at:
    www.domain.com/my-first-blog/ with an ID of 5 will now link as:

    There you now have the minimum 3 digit (length) unique ID required by Google News in each article URL.

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.