-
AuthorPosts
-
April 14, 2018 at 10:40 am #941867
Hello,
I’m using your theme (enfold) for a multilingual Italian and English site.
I activated the Polylan plugin, which indexes all the pages with hreflang, except the home page. Google returns me a crawl error for the home page due to the absence of the hreflang tag.
How can I solve the problem ?
I would like to insert the tag in both English and Italian for the home page.
This is the website http://www.borgomummialla.comThank you
LorenzoApril 14, 2018 at 10:48 am #941870April 14, 2018 at 11:05 am #941873Before writing here, I changed the settings in Polylang, inserting the check mark:
(The homepage URL contains the language code instead of its name or ID.)
Maybe Google needs more time?
I took the test here: https://technicalseo.com/seo-tools/hreflang/
but I continue to have the error.Another thing.
When I use sites with a single language, how can I add the hreflang tag to Enfold?Thank you
April 14, 2018 at 8:58 pm #942040you can insert it via functions.php of child-theme: (guess it is italian)
add_action('wp_head', 'insert_hreflang_info'); function insert_hreflang_info() { ?> <link rel="alternate" href="https://www.borgomummialla.com/" hreflang="it"> <?php }
but i guess that the x-default is ok – it tells the bots that this is the default language
and if an international visitor ( someone else than italian or english) comes to your site it is redirected to the root directory
on my opinion this is the perfect setting !the error is not the setting of the hreflang but that it is redirected to the /it/ page !
so your have here to decide what is your x-default :
maybe you test this better ( and i think for international visitors the english is better):add_action('wp_head', 'insert_hreflang_info'); function insert_hreflang_info() { ?> <link rel="alternate" href="https://www.borgomummialla.com/en/" hreflang="x-default"> <?php }
April 15, 2018 at 6:08 am #942122Hi,
Thanks for helping out and sharing @guenni007. Did you get your questions answered @lorenzofusi1976?
Best regards,
RikardApril 16, 2018 at 11:30 am #942513Hi,
I entered the code as recommended by @ guenni007 in functions.php of child-theme.add_action (‘wp_head’, ‘insert_hreflang_info’);
function insert_hreflang_info () {
?>
<link rel = “alternate” href = “https://www.borgomummialla.com/en/” hreflang = “x-default”>
<? Php
}But checking the url
https://www.borgomummialla.com/it/
on
https://technicalseo.com/seo-tools/hreflang/I see that there are two x-default tags and I do not know if it’s correct.
Also, I notice that if I insert the link intragally
“https://www.borgomummialla.com/en/” the data are returned
if I enter “www.borgomummialla”, the data will not be returnedCan this https redirect be a problem for Google?
April 16, 2018 at 11:45 am #942522i do not have any polylang on my testing pages.
The head is on my opinion correct – the thing is that the page is redirected via 302
better would be to get rid of my code above and look into polylang settings if there is any chance to manage that.i don’t know why polylang sets here a 302 redirect.
Edit: there must be a checkmark for: “Hide URL language information for default language”
than the x-default isn’t set – and i guess that should be the setting you have to choice .ON may WPML i can set f.e. the root url is german – and the other languages are /en, /it etc.
In this case it makes sense that i have x-default.so checkmark for: “Hide URL language information for default language” and look what happens in your testing page
April 16, 2018 at 12:36 pm #942541I deleted the code and put the check mark “Hide the language information from the URL for the default language”
now it seems to work, I think it is a mandatory setting
despite everything, in the test if I do not insert all the links with https, now returns error 301.
can it be correct to leave everything like this?
Thank you
April 17, 2018 at 10:25 pm #943279Hi,
Yes it can be fine, there should be no issues at all.
Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.