Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Unique id for articles for Google News.


Go to End


1775 Views

Avatar
ScottiouS

Community Member, 54 Posts

2 July 2007 at 1:53pm

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:
www.domain.com/my-first-blog/005

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