SergioE Posted January 25, 2017 Share Posted January 25, 2017 Buenas, Para una versión de Prestashop 1.6.0.9 tengo este código para insertar en el header.tpl, alguien puede confirmarme que es el correcto para tener canonicals? {if $page_name == 'category'} <link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" /> {/if} {if $page_name == 'product'} <link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" /> {/if} {if $page_name == 'cms'} <link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" /> {/if} {if $page_name == 'manufacturer'} <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, null, null, $id_lang, null, 0, false)}" /> {/if} Saludos Link to comment Share on other sites More sharing options...
SergioE Posted January 27, 2017 Author Share Posted January 27, 2017 Up Link to comment Share on other sites More sharing options...
idoia Posted January 28, 2017 Share Posted January 28, 2017 yo lo tenia y no funciona. Link to comment Share on other sites More sharing options...
SergioE Posted July 9, 2017 Author Share Posted July 9, 2017 He probado este código en el header.tpl y me funciona bien para la ultima version de Prestashop 1.6.1.15 Si alguien quiere probar o confirmar que es correcto, tengo mis dudas aun funcionando bien. Es mejor comprar un modulo? {if $page_name == 'category'} <link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" /> {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} {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}{/if} {/if} {if $page_name == 'product'} <link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" /> {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} {/if} {if $page_name == 'cms' && $smarty.get.id_cms > 0} <link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" /> {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} {/if} {if $page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0} <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" /> {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} {/if} {if $page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)} <link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" /> {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} {/if} {if $page_name == 'index'} <link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" /> {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} {/if} 3 Link to comment Share on other sites More sharing options...
distritoverde Posted January 23, 2018 Share Posted January 23, 2018 Estimado Con este código elimino todas la indexación de todas las páginas que pueda tener duplicadas en mi web?. Se debe pegar en el header.tpl antes de algun código en especifico o en cualquier lugar? Link to comment Share on other sites More sharing options...
Nedned Posted January 24, 2018 Share Posted January 24, 2018 con eso intenta evitar parte de la duplicación de contenido para "mejorar" frente a google Link to comment Share on other sites More sharing options...
SergioE Posted January 26, 2018 Author Share Posted January 26, 2018 Exacto, ponlo justo despues de la etiqueta: <head> Link to comment Share on other sites More sharing options...
jd250 Posted May 1, 2020 Share Posted May 1, 2020 En 10/7/2017 a las 12:25 AM, SergioE dijo: He probado este código en el header.tpl y me funciona bien para la ultima version de Prestashop 1.6.1.15 Si alguien quiere probar o confirmar que es correcto, tengo mis dudas aun funcionando bien. Es mejor comprar un modulo? {if $page_name == 'category'} <link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" /> {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} {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}{/if} {/if} {if $page_name == 'product'} <link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" /> {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} {/if} {if $page_name == 'cms' && $smarty.get.id_cms > 0} <link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" /> {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} {/if} {if $page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0} <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" /> {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} {/if} {if $page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)} <link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" /> {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} {/if} {if $page_name == 'index'} <link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" /> {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} {/if} ¿Cuál sería el equivalente para prestashop 1.7.6.5? Mil gracias Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now