Simply add canonical links to PrestaShop 1.6

How to add canonical information on PrestaShop 1.6

Finally deciding to take a look at the quality of my site in the context of SEO (Search Engine Optimization), I noticed that PrestaShop 1.6 doesn't integrate canonical links in the header of its pages.

So I set about implementing this information on every page of my site, supposedly to improve my SEO.

So here's the code I added to my theme in the header.tpl file, of course between the <head></head> tags.

{if $page_name == 'category'}
	<link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />
	{if $start!=$stop}{if $p != 1 && $p_previous != 1}{assign var='p_previous' value=$p-1}
		<link rel="prev" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}{$link->goPage($requestPage, $p_previous)}" />{/if}
	{if $pages_nb > 1 AND $p != $pages_nb}{assign var='p_next' value=$p+1}
		<link rel="next" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}{$link->goPage($requestPage, $p_next)}" />{/if}
{elseif $page_name == 'product'}
	<link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />
{elseif $page_name == 'cms'}
	{if $smarty.get.id_cms > 0}
		<link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />
	{elseif $smarty.get.id_cms_category > 0}
		<link rel="canonical" href="{$link->getCMSCategoryLink($smarty.get.id_cms_category, null, false, $id_lang)}" />
{elseif $page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0}
	<link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" />
{elseif $page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)}
	<link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" />
{elseif $page_name == 'index'}
	<link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" />

Nothing more, nothing less, and let's wait and see if this addition will improve my SEO and bring me lots of new customers.