
-
AuthorPosts
-
September 3, 2020 at 9:23 am #1243031
Hi,
when using the menu item desciption (span.avia-menu-subtext) in the main menu, it confuses Google regarding the title of the Sitelinks in the Google search.
The menu items are for example:
Über uns
Erfahren Sie mehr über uns
–> Title of Sitelink: Über unsErfahren Sie mehr …Kontakt
Nehmen Sie Kontakt mit uns auf
–> Title of Sitelink: KontaktNehmen Sie Kontakt …Is there a way to “teach” Google to separate the avia-menu-text from the avia-menu-subtext?
Or to ignore the avia-menu-subtext?Thanks,
Dorian-
This topic was modified 4 years, 10 months ago by
d0r1an-web.
September 8, 2020 at 4:07 am #1244135Hey Dorian,
I’m very sorry for the late reply. I’m not sure I understand the problem or what you would like to change unfortunately, could you try to explain the problem a bit further please?
Best regards,
RikardSeptember 8, 2020 at 9:41 am #1244221Hi Rikard,
thank you for taking the time.
I will add an image, that should help clear things up.Those Sitelinks are automated by Google. They seem to be produced from the main menu of the website.
Can the source code of the main menu of the website be changed so Google does understand that “Kontakt” and ” Nehmen Sie Kontakt mit uns auf” needs to be separated in the sitelink?
Thanks,
Dorian-
This reply was modified 4 years, 10 months ago by
d0r1an-web.
September 21, 2020 at 6:31 am #1247263Hi Dorian,
I’m very sorry for the late reply. I wasn’t sure what you meant by your request so I brought it up for internal discussion with the other moderators, but they don’t understand your request either. I don’t think that what you are asking is possible unfortunately.
Best regards,
RikardSeptember 21, 2020 at 7:13 pm #1247440Hi Rikard,
ok but you guys know Google’s sitelinks?
Is it a matter of not understanding the request? Or not having a solution?I’m not saying I found a solution, I just noticed the error is maybe caused by the way the main menu is coded?
I don’t know exactly how Google creates these sitelinks – can I influence them myself?Thanks,
DorianSeptember 22, 2020 at 8:53 am #1247540Hi Dorian,
Thanks for the update. I don’t know anything about it myself unfortunately, and judging from our internal discussion, the other moderators don’t either. What is presented to search engines on the front end of your site is just plain HTML, so I don’t think it’s a problem with how the menu is coded.
I can’t answer how Google creates those links unfortunately.
Best regards,
RikardSeptember 23, 2020 at 5:01 pm #1247932This looks like a very similar problem to mine: https://www.codefixer.com/blog/how-to-fix-unwanted-sitelinks-appearing-in-google-search/
The solution there was to use “the correct anchor text for the internal link”.
That’s where I think Google gets confused by your code because you guys put both spans (avia-menu-text and avia-menu-subtext) inside the same internal link.
Is it possible to separate both spans into separate links? I think that might help..Like
<a> <span class="avia-menu-text">Leistungen</span> </a> <a> <span class="avia-menu-subtext">Unsere Kompetenzen im Detail</span> </a>
Cheers,
DorianSeptember 27, 2020 at 2:07 am #1248734Hi,
Sorry for the late reply, and thanks for the details, I believe it would be possible to separate these into separate links, but then you would have twice the links for Google to decide what to show in the sitemaps, which may not work out well.
While researching I found that Google suggests in the context of sitelinks, to: use anchor text and alt text that’s informative, compact, and avoids repetition.
So perhaps we can add a title or alt to the text & sub-text of your menu to clarify them to Google.
For example, try adding this code to the end of your functions.php file in Appearance > Editor:function custom_script(){ ?> <script> (function($){ $(document).ready(function(){ $(".menu-item-top-level").each(function(){ $(this).find(".avia-menu-text").attr('title','title'); $(this).find(".avia-menu-subtext").attr('title','subtitle'); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
This is the result:
<a href="https://your-site.de/aktuelles/"> <span class="avia-bullet"></span><span class="avia-menu-text" title="Title">Aktuelles</span> <span class="avia-menu-subtext" title="subtitle">Neuigkeiten rund um Huber</span> <span class="avia-menu-fx"> <span class="avia-arrow-wrap"><span class="avia-arrow"></span></span> </span> </a>
I was not able to find out if “titles” are best to use, but since Google recognizes other titles this might be enough to help.
Best regards,
MikeSeptember 28, 2020 at 9:48 am #1248944Hi Mike,
very much appreciate you taking the time to explore this issue.
I’ve implemented the function and see the new title element in the website code.I will let you know the results after Google indexed the new version of the site.
Cheers,
DorianSeptember 28, 2020 at 12:20 pm #1248968Hi,
Very good, we will leave this open to hear back from you. We can also change this to use “alt” instead of the “title”, I’m just not sure which one would be better.Best regards,
MikeOctober 16, 2020 at 12:57 pm #1253244Hi Mike,
unfortunately Google did not understand what we’re trying to tell them – neither by using TIRLE nor ALT.
The way I understand the guidelines it would be worth a try to apply an ALT and or TITLE attribute to the link, the actual A element, not the spans inside. The ALT element could contain the content from both the text and subtext with a seperator like – or |:
<a href="https://www.huber-fusstechnologie.de/leistungen/" alt="Leistungen | Unsere Kompetenzen im Detail"> <span class="avia-menu-text">Leistungen</span> <span class="avia-menu-subtext">Unsere Kompetenzen im Detail</span> </a>
Is that possible?
Would you agree it’s worth a try?Best regards,
DorianOctober 18, 2020 at 8:48 pm #1253700Hi,
Ok, this script gets the menu text & the menu subtext and adds it to the menu link “a” as an alt attitude.
Try adding this code to the end of your functions.php file in Appearance > Editor:function custom_menu_alt_subtext_script(){ ?> <script> (function($){ $(document).ready(function(){ $(".menu-item-top-level").each(function(){ var menu_title = $(this).find(".avia-menu-text").first().text(); var menu_subtitle = $(this).find(".avia-menu-subtext").first().text(); $(this).find("a").first().attr("alt", menu_title +' | '+ menu_subtitle); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_menu_alt_subtext_script');
and remove the other script, then clear your browser cache and check.
Best regards,
MikeOctober 19, 2020 at 9:53 am #1253874Hi Mike,
thanks a lot, I’ve implemented you code, works fine.
I will let you know in a week or so if Google now gets it ;-)Thank you for your efforts.
DorianOctober 19, 2020 at 2:55 pm #1253978Hi Dorian,
Ok, we will keep the thread open for now and wait for your feedback.
Best regards,
Victoria -
This topic was modified 4 years, 10 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.