Skip to content

Instantly share code, notes, and snippets.

@herveguetin
Created May 26, 2014 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herveguetin/6fb8727e73d789ea8d5e to your computer and use it in GitHub Desktop.
Save herveguetin/6fb8727e73d789ea8d5e to your computer and use it in GitHub Desktop.
Add canonical URL to Magento <head>
<?php
$canonicalUrl = Mage::getBaseUrl(); // your logic...
$this->getLayout()
->getBlock('head')
->addLinkRel('canonical', $canonicalUrl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment