-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
The structured data items may contain fields that do not comply with Google's guidelines, which can negatively impact SEO. #9319
Comments
version: v2.3.1 |
Hey 👋 First when opening bugs, please make sure to always use the latest stable version. In this case it doesn't seem to matter, but it could. It seems that change was done for a reason by @Josh-Cena here: #7304 I'm not 100% sure to understand what is your suggestion and why. A real, concrete example always helps. My suggestion:
|
@johnnyreilly any opinion on the suggested change? |
Hello, the following HTML website was selected from your official user cases, and it has the same issue as mine – both failed to pass the validation of schema.org and Google. The validation tool's website - schema.org
|
Thanks @TingJianZheng And now can you please modify manually this HTML to show what exactly should be the desired output? This way we can validate the desired output and see if tools like it better. And then we can try to provide the dDocusaurus implementation to emit that output.
I don't understand your text here, that's also why I ask for a very concrete before/after example. According to what I see in our code, href and position are not related 🤷♂️ By the way Google seems to be ok with your Algolia page example: ![]() |
Hi @slorber, I suspect that migrating from microdata to JSON-LD structured data (as I've proposed for blogs here: #9274) would resolve the issue. That's likely a cleaner approach. Fwiw I've swizzled breadcrumb JSON-LD structured data on my blog and it's pretty straightforward - I've written about it here: https://johnnyreilly.com/docusaurus-blogs-adding-breadcrumb-structured-data |
Seems like this issue is still present in v3.7 @johnnyreilly , cf duplicate report: #10859 |
I can't guarantee when, but this is on my mind to tackle when I get some free time |
Had a quick dig and I think changes should be fairly small - potentially just to this file: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-classic/src/theme/DocBreadcrumbs/index.tsx And we could base the approach on the code here: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-classic/src/theme/BlogListPage/StructuredData/index.tsx And it should align with the Google desired output described here: https://developers.google.com/search/docs/appearance/structured-data/breadcrumb#json-ld |
I've put up a PR: #10888 |
Thanks @johnnyreilly, using JSON-LD will help improve consistency. Your PR implements a different behavior: instead of adding Although it solves the problem in terms of schema/validation, to me it also changes the breadcrumb structure that the schema describes, since unlinked categories are now excluded from the breadcrumb. It's hard to find any reference documentation from Google about this, but... On this page: https://schema.org/BreadcrumbList
Although we still aren't sure how to deal with our Docusaurus breadcrumb which may contain unlinked breadcrumb categories, it's quite explicit that all the On this page: https://stackoverflow.com/a/56231927/82609 A knowledgeable Structured Data user (answered hundreds of questions) said:
On this page: https://developers.google.com/search/docs/appearance/structured-data/breadcrumb?hl=en
So, I think it's clear overall: all the items must have an URL (except the very last one, the URL is inferred to the current page). I'm going to accept the proposal of @johnnyreilly, removing the unlinked categories from the breadcrumb, since they do not really participate in the navigation path of the user, but are just a "visual way" to group things. If anyone is unhappy with this choice, the easy workaround is to just create a doc or generated index for the categories that do not have one. Other alternatives I considered:
All this is quite difficult to get right and I'm not even sure it's that impactful so I hope this is the last time we have to ever think about this problem 😅 |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
node_modules/@docusaurus/theme-classic/lib/theme/DocBreadcrumbs/index.js
Why is an href required here to add a ListItem? It seems like there might be some issues with this approach. (For objects of type "BreadcrumbList," schemas such as schema.org don't recognize "position" as a valid property.)
reference file: https://developers.google.com/search/docs/appearance/structured-data/breadcrumb#structured-data-type-definitions
![image](https://private-user-images.githubusercontent.com/116697357/268601113-0b31e648-7d30-445a-949e-1844755f465e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjYwOTksIm5iZiI6MTczOTQ2NTc5OSwicGF0aCI6Ii8xMTY2OTczNTcvMjY4NjAxMTEzLTBiMzFlNjQ4LTdkMzAtNDQ1YS05NDllLTE4NDQ3NTVmNDY1ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxNjU2MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jNzY4NWFkMDY3MjU4MThmZmEyMmVjMDg5ODNmMDNlZDUyNTlkYjljMGFlNmMzNWVlN2NiNWQzZjA3MGVhMmYwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.mxYXwQsiQEPuPYNEyX4uCKUSyPSODTSlc6XgbxtHGlg)
Reproducible demo
No response
Steps to reproduce
, In the SidebarsConfig, whenever an element's type is "Category" and it doesn't need to include the href attribute, you may encounter this issue of structured data inconsistency.
![image](https://private-user-images.githubusercontent.com/116697357/268598638-762bd38b-ce61-4e3d-8463-47a40ab8c424.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjYwOTksIm5iZiI6MTczOTQ2NTc5OSwicGF0aCI6Ii8xMTY2OTczNTcvMjY4NTk4NjM4LTc2MmJkMzhiLWNlNjEtNGUzZC04NDYzLTQ3YTQwYWI4YzQyNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxM1QxNjU2MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNGRkYjFjNzMxMWIyOWNhNjliMjY3OTg5YzM1YTI3YTc4ODUxMmMwYzYwZTVkNDVmOGZiMTA0ZjIzYjY5NzI1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.QlfhNHCutxuIJ9nCDb4blQdxJKlHnTrepJGqmEiRDxw)
Expected behavior
I believe there's no need to determine whether it's part of the breadcrumb navigation based on the presence of href here, as this is already within the breadcrumb navigation itself.
Actual behavior
The href is an optional attribute, but it is used to determine whether it is a part of the breadcrumb.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: