dmouradov Posted August 26, 2015 Share Posted August 26, 2015 (edited) 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 August 26, 2015 by dmouradov (see edit history) Link to comment Share on other sites More sharing options...
mickeyboy1 Posted August 26, 2015 Share Posted August 26, 2015 None of them 3 links work. Link to comment Share on other sites More sharing options...
dmouradov Posted August 26, 2015 Author Share Posted August 26, 2015 www.deltawings.fr Link to comment Share on other sites More sharing options...
dmouradov Posted August 27, 2015 Author Share Posted August 27, 2015 no one tell me how can I fix it? Link to comment Share on other sites More sharing options...
mickeyboy1 Posted August 28, 2015 Share Posted August 28, 2015 I think that means that in each of the three other sites I.E: www.deltawings.fr/en, www.deltawings.fr/fr, and www.deltawings.fr/ru there are no links that go back to www.deltawings.fr (the main site) 1 Link to comment Share on other sites More sharing options...
dmouradov Posted August 28, 2015 Author Share Posted August 28, 2015 Thanks for the answer . that is, I need to add ? <link rel="alternate" href="http://deltawings.fr/" hreflang="x-default" /> Link to comment Share on other sites More sharing options...
kmorgen Posted September 10, 2015 Share Posted September 10, 2015 You can use this module instead: http://www.matteobononi.it/prestashop_module_hreflang.php Link to comment Share on other sites More sharing options...
dmouradov Posted September 10, 2015 Author Share Posted September 10, 2015 Thank kmorgen This module adds the code in the body , but we need to in head Link to comment Share on other sites More sharing options...
dmouradov Posted September 11, 2015 Author Share Posted September 11, 2015 (edited) 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 September 11, 2015 by dmouradov (see edit history) Link to comment Share on other sites More sharing options...
dmouradov Posted September 11, 2015 Author Share Posted September 11, 2015 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 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