Jump to content

Edit History

MD85

MD85

On 12/4/2019 at 8:47 PM, gusman126 said:

Tengo un modulo a la venta que añade este código en el head.tpl

Si lo usas debes limpiar todos los ficheros tpl de la plantilla donde indiquen algo de hreflang y canonical


{if $page.page_name == 'category'}
	<link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />    
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCategoryLink($smarty.get.id_category, null, $this->context->language->id,null,null )}" />
	{/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.page_name == 'product'}    
<link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />    
	{if $langs|@count > 1}
	{foreach $langs 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}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $this->context->language->id, null, 0, false)}" />
	{/if} 

{/if}



{if $page.page_name == 'cms' && $smarty.get.id_cms > 0}
	<link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0}
	<link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" />    
	{if $langs|@count > 1}
	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)}
<link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" />    
	{if $langs|@count > 1}

	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('manufacturer', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('manufacturer', 'true', $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'index'}
<link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" />   
 
{if $langs|@count > 1}
	{foreach $langs as $lang}
		<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('index', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('index', 'true', $this->context->language->id)}" />
{/if}
	
{/if}

 

Hola, 

He añadido dicho código y solamente aparece www.miweb.com/es hreflang="es", pero no aparece www.miweb.com/en hreflang="en". 

¿Me podría ayudar?

Gracias.

MD85

MD85

On 12/4/2019 at 8:47 PM, gusman126 said:

Tengo un modulo a la venta que añade este código en el head.tpl

Si lo usas debes limpiar todos los ficheros tpl de la plantilla donde indiquen algo de hreflang y canonical


{if $page.page_name == 'category'}
	<link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />    
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCategoryLink($smarty.get.id_category, null, $this->context->language->id,null,null )}" />
	{/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.page_name == 'product'}    
<link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />    
	{if $langs|@count > 1}
	{foreach $langs 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}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $this->context->language->id, null, 0, false)}" />
	{/if} 

{/if}



{if $page.page_name == 'cms' && $smarty.get.id_cms > 0}
	<link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0}
	<link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" />    
	{if $langs|@count > 1}
	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)}
<link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" />    
	{if $langs|@count > 1}

	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('manufacturer', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('manufacturer', 'true', $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'index'}
<link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" />   
 
{if $langs|@count > 1}
	{foreach $langs as $lang}
		<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('index', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('index', 'true', $this->context->language->id)}" />
{/if}
	
{/if}

 

Hola, 

He añadido dicho código y cambiando lang_iso por language.iso_code solamente aparece www.miweb.com/es hreflang="es", pero no aparece www.miweb.com/en hreflang="en". Si dejo lang_iso no aparece nada, ni es español ni en inglés.

¿Me podría ayudar?

Gracias.

MD85

MD85

On 12/4/2019 at 8:47 PM, gusman126 said:

Tengo un modulo a la venta que añade este código en el head.tpl

Si lo usas debes limpiar todos los ficheros tpl de la plantilla donde indiquen algo de hreflang y canonical


{if $page.page_name == 'category'}
	<link rel="canonical" href="{$link->getCategoryLink($smarty.get.id_category, null, $id_lang,null,null )}" />    
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCategoryLink($smarty.get.id_category, null, $this->context->language->id,null,null )}" />
	{/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.page_name == 'product'}    
<link rel="canonical" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $id_lang, null, 0, false)}" />    
	{if $langs|@count > 1}
	{foreach $langs 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}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $this->context->language->id, null, 0, false)}" />
	{/if} 

{/if}



{if $page.page_name == 'cms' && $smarty.get.id_cms > 0}
	<link rel="canonical" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $id_lang)}" />
	{if $langs|@count > 1}
		{foreach $langs as $lang}
			<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />
		{/foreach}
	{else}
		<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && $smarty.get.id_manufacturer > 0}
	<link rel="canonical" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $id_lang)}" />    
	{if $langs|@count > 1}
	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getManufacturerLink($smarty.get.id_manufacturer, null, $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'manufacturer' && !isset($smarty.get.id_manufacturer)}
<link rel="canonical" href="{$link->getPageLink('manufacturer', 'true', $id_lang)}" />    
	{if $langs|@count > 1}

	{foreach $langs as $lang}
	<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('manufacturer', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('manufacturer', 'true', $this->context->language->id)}" />
	{/if}
{/if}

{if $page.page_name == 'index'}
<link rel="canonical" href="{$link->getPageLink('index', 'true', $id_lang)}" />   
 
{if $langs|@count > 1}
	{foreach $langs as $lang}
		<link rel="alternate" hreflang="{$lang.iso_code}" href="{$link->getPageLink('index', 'true', $lang.id_lang)}" />
	{/foreach}
	{else}
	<link rel="alternate" hreflang="{$lang_iso}" href="{$link->getPageLink('index', 'true', $this->context->language->id)}" />
{/if}
	
{/if}

 

Hola, 

He añadido dicho código y solamente aparece www.miweb.com/es hreflang="es", pero no aparece www.miweb.com/en hreflang="en".

¿Me podría ayudar?

Gracias.

×
×
  • Create New...