-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix text from menu bar in Google Search #2397
base: master
Are you sure you want to change the base?
Conversation
This replacement makes mdbook more semantically correct and should remove "Light; Rust; Coal; Navy; Ayu. Title" text from mdbook preview in Google search.
Thanks! Seems like it would be great to fix this. Do you happen to know if there is a way to test how Google generates the snippet? Or do you have any links to information about whether or not this will make a difference? All I could find is https://developers.google.com/search/docs/appearance/snippet?hl=en, which only really mentions adding a description. |
@ehuss I also tried to find information, but didn't find anything. Experienced web-developers suggested that semantic layout is very important and Google somehow takes this into account when indexing. |
Thanks for pointing this out @vklachkov! I could be wrong, but I don't think a
|
Sorry for the long wait, @jsha. I think that although both nav and data-nosnippet will work, it is not very correct semantically. To quote MDN:
I think header tag would be more semantically correct. But if you insist, I can replace it with nav, as in rust doc. |
That's interesting @vklachkov! Also from MDN, in the historical note section:
And indeed I was thinking of I'm not a maintainer on mdBook, so I don't insist either way, and I don't have an opinion as to whether I suppose my recommendation to the mdBook team would be to go ahead and accept this as harmless and easy, and if it doesn't do the job @vklachkov could submit a followup PR with |
I noticed an issue that Google for some mdBooks in the search results shows a list of themes and the title of the book. It's a small thing, but an eyesore.
My guess is that Google thought
#menu-bar
is the part of the page content and indexed it. To prevent this, I replaced the tag of menu with<header>
.