17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1280 Views |
-
Unique id for articles for Google News.

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/005There you now have the minimum 3 digit (length) unique ID required by Google News in each article URL.
| 1280 Views | ||
|
Page:
1
|
Go to Top |

