rubendivall

Rel canonical and hreflang for header.tpl prestashop 1.6.x

Jan 5th, 2015
6,266
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {if $page_name == 'category'}
  2. <link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />    
  3. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />{/foreach}{/if}
  4. {if $start!=$stop}{if $p != 1 && $p_previous != 1}{assign var='p_previous' value=$p-1}
  5. <link rel="prev" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}{$link->goPage($requestPage, $p_previous)}" />{/if}
  6. {if $pages_nb > 1 AND $p != $pages_nb}{assign var='p_next' value=$p+1}
  7. <link rel="next" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}{$link->goPage($requestPage, $p_next)}" />{/if}{/if}
  8. {/if}
  9. {if $page_name == 'product'}    
  10. <link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />    
  11. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $lang.id_lang, null, 0, false)}" />{/foreach}{/if} 
  12. {/if}
  13. {if $page_name == 'cms' && $smarty.get.id_cms > 0}
  14. <link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />
  15. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />{/foreach}{/if}
  16. {/if}
  17. {if $page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0}
  18. <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" />    
  19. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang)}" />{/foreach}{/if}
  20. {/if}
  21. {if $page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)}
  22. <link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" />    
  23. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('manufacturer', 'true', $lang.id_lang)}" />{/foreach}{/if}
  24. {/if}
  25. {if $page_name == 'index'}
  26. <link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" />    
  27. {if $languages|@count > 1}{foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('index', 'true', $lang.id_lang)}" />{/foreach}{/if}
  28. {/if}
RAW Paste Data