Fork me on GitHub
Current releases are 2.1.3 (9 Sept 2014) and 2.0.18.13 (5 Aug 2014)

Ready for 2.1? Find out if your plugins are compatible. 2.0 will no longer be updated after Dec 2014.

SEO trick (for developers)

SS
edited March 2011 in Vanilla 2.0 Help
For example, news. Just example, no explanations

Example:

// class.newsconttroller.php // file

// public function Index($Code) {
if (is_numeric($Code)) {
$this->View($Code);
}
// elseif(... other check for news category url code, etc.
}

...
// public function View() { // method
...
// trick
$NewsModel = Gdn_NewsModel();
$Story = $NewsModel->GetID($NewsID);
...
$NewsStoryURL = 'news/'.$Story->NewsID.'/'.Gdn_Format::Url($News->Title); // or you can use Clean() method
$CanonicalUrl = $this->CanonicalUrl(Url($NewsStoryURL, True));
if ($NewsStoryURL != $this->SelfUrl) Redirect($CanonicalUrl, 301);
...

Comments

Sign In or Register to comment.