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
Add structured data example #2129
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2129 +/- ##
=======================================
Coverage 91.30% 91.30%
=======================================
Files 7 7
Lines 690 690
=======================================
Hits 630 630
Misses 60 60
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks for this contribution @jmshea! I see that this is using JSON-LD to embed structured information to a built site. Would you be happy to add more context to this, briefly, e.g.
etc. I didn't realise that this was already exposed to site authors, how exciting! |
@agoose77 Thank you for the quick feedback. Yes, I can do that. |
@agoose77 I have updated the discussion per your suggestions. See what you think. |
@agoose77 Thanks for revising and fixing my typo (original "directly" was supposed to "directory"). Let me know if there is anything else I need to do. |
@jmshea do you know whether crawlers like Google wait for the JS to load before inspecting the structured metadata? i.e., does dynamically appending to the DOM like this work in practice? |
@agoose77 Yes, this is explicitly mentioned in the Google docs, and I have tested this on my own sites already, and it works. |
To see that this works, you can go to Google's Rich Results Test (https://search.google.com/test/rich-results) and put in my book's website: https://www.fdsp.net This suggested addition to the JupyterBooks docs is based on how I got this working on my own site. |
@agoose77 Please let me know if any other updates are needed. |
Structured data helps machines (particularly Google Search) better understand your pages' contents. Here I show how to add some of the most basic structured data (site name and search path) by adding a small Javascript+JSON snipppet in the _static directory.