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'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.

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


1976 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.