Jump to content

hreflang backlinks ERROR


dmouradov

Recommended Posts

Hi all I ask your advice

 

I added hreflang code in header.tpl

 

<link rel="alternate" hreflang="en-us" href="http://www.mypage.fr/en/">

<link rel="alternate" hreflang="fr-fr" href="http://www.mypage.fr/fr/">

<link rel="alternate" hreflang="ru-ru" href="http://www.mypage.fr/ru/">

 

after Google indexing in  Webmaster tools there is an error

(On the page with the language code en-us no backlinks.)

(On the page with the language code fr-fr no backlinks.)

(On the page with the language code ru-ru no backlinks.)

 

how to fix it ?

 

Thanks and sorry for bad English

Edited by dmouradov (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...


Here's the modul code It can be a problem on the line 52 ?


<?php

if (!defined('_PS_VERSION_'))

exit;

 

class hreflang_on_pages extends Module

{

public function __construct()

{

$this->name = 'hreflang_on_pages';

$this->tab = 'seo';

$this->version = '1.0';

$this->author = 'Matteo Bononi';

$this->need_instance = 0;

$this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6');

$this->bootstrap = true;

 

parent::__construct();

 

$this->displayName = $this->l('hreflang on pages');

$this->description = $this->l('define hreflang on pages to avoid content duplication with multilanguage');

 

$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');

 

if (!Configuration::get('HREFLANG_ON_PAGES_NAME'))

$this->warning = $this->l('No name provided');

}

 

public function install()

{

if (Shop::isFeatureActive())

Shop::setContext(Shop::CONTEXT_ALL);

if (!parent::install() ||

!$this->registerHook('header') ||

!Configuration::updateValue('HREFLANG_ON_PAGES_NAME', '{}')

)

return false;

 

return true;

}

 

public function uninstall()

{

if (!parent::uninstall() ||

!Configuration::deleteByName('HREFLANG_ON_PAGES_NAME')

)

return false;

 

return true;

}

 

 

public function hookDisplayHeader()

{

 

$this->context->smarty->assign(

array(

'hreflang_on_pages_name' => Configuration::get('HREFLANG_ON_PAGES_NAME'),

'hreflang_on_pages_link' => $this->context->link->getModuleLink('hreflang_on_pages', 'display')

)

);

return $this->display(__FILE__, 'hreflang_on_pages.tpl');

 

}

 

 

}

 

 

 

?>

 

Edited by dmouradov (see edit history)
Link to comment
Share on other sites

In header.tpl i added this cod  and it works. 

<!--  START hreflang on pages  -->
{if $page_name == 'category'}
{foreach $languages as $lang}       
<link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCategoryLink($smarty.get.id_category, null, $lang.id_lang,null,null )}" />	   
{/foreach}
{/if}

{if $page_name == 'product'} 
{foreach $languages as $lang}       
<link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getProductLink($smarty.get.id_product, null, null, null, $lang.id_lang, null, 0, false)}" />	   
{/foreach}
{/if}

{if $page_name == 'cms'} 
{foreach $languages as $lang}       
<link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getCMSLink($smarty.get.id_cms, null, false, $lang.id_lang)}" />	   
{/foreach}
{/if}

{if $page_name == 'contact'} 
{foreach $languages as $lang}       
<link rel="alternate" hreflang="{$lang.language_code}" href="{$link->getPageLink(contact, null, $lang.id_lang, null, null, null)}" />	   
{/foreach}
{/if}

{if $page_name == 'index'}
{foreach $languages as $lang}       
<link rel="alternate" hreflang="{$lang.iso_code}" href="{if $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}{$lang.iso_code}/"/>
{/foreach}
{/if}

<!--  END hreflang on pages  -->
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...