Jump to content

Canonical en diferentes idiomas en el Index


jorge Villa

Recommended Posts

Buenas,

 

Tengo una web en 3 idiomas pero el canincal de cada home de cada una de ellas son iguales en vez de que salga con la coletilla de "es", "en" y "fr".

 

Por ejemplo:

 En el idioma español la url es www.sublimet.com/es/ pero en el canonical me sale www.sublimet.com.

 

Alguien sabe como modificar esto? Me está dando muchos problemas de indexación en google.

 

Gracias,
Saludos

Link to comment
Share on other sites

Hola,

 

Gracias por responder. El código es:

 

<!-- canonical {$page_name} -->
{if $page_name == 'index'}
    <link rel="canonical" href="{$base_dir}" /> <!-- h -->
{elseif $page_name == 'category' or $page_name == 'best-sales'
    or $page_name == 'cart' or $page_name == 'discount'
    or $page_name == 'manufacturer' or $page_name == 'new-products'
    or $page_name == 'prices-drop' or $page_name == 'search'}


        <link rel="canonical" href="{$base_dir}{$request_uri|substr:1|regex_replace:'/\/(.*)/':''|regex_replace:'/\?(.*)/':''}" />


{else}
    <link rel="canonical" href="{$base_dir}{$request_uri|substr:1}" /><!-- d -->
{/if}
<!-- /canonical -->
*}

<!-- canonical {$page_name}-->
{if $page_name == 'category'}
    <link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />    
    {* {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 $page_name == 'product'}
    <link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />    
    {* {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 $page_name == 'index'}
    <link rel="canonical" href="{$base_dir}" />    
{/if}
{if $page_name == 'cms'}
    <link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />    
    {* {foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.lang_iso}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />{/foreach} *}
{/if}

{*
{if $page_name == 'manufacturer'}
    <link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, null, null, $id_lang, null, 0, false)}" />    
    {foreach $languages as $lang}<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, null, null, $lang.id_lang, null, 0, false)}" />{/foreach}
{/if}
*}
<!-- /canonical -->

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...