Serve the docs gallery from web-sized images so Google can fetch it - #228
Merged
Merged
Conversation
scripts/make_gallery_images.py trims the white margin off every examples/graphs/*.png, scales it to at most 1400 px wide and writes a WebP copy to docs/assets/gallery/, recording the source hash in sources.json so reruns skip files that are already up to date. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The gallery embedded twelve full-size PNGs from raw.githubusercontent.com, about 13.8 MB in total, and Google Search Console could not fetch the page. Each example now shows the web-sized WebP from docs/assets/gallery/ with explicit width and height, lazy loading on all but the first image and the glightbox skip class, wrapped in a link to the full-size PNG. The page's image weight drops to about 0.7 MB. Headings, anchors, prompts, commands and download links are unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
What and why
Google Search Console's "Test live URL" and "Request indexing" both failed on
/gallery/with "Something went wrong", while lighter pages on the same site passed. Measuring the page confirmed it was very heavy: it embedded twelve full-size PNGs straight from raw.githubusercontent.com.Changes:
scripts/make_gallery_images.pyreads everyexamples/graphs/*.png, trims the surrounding white space, scales it to at most 1,400 px wide and writes a WebP (quality 85) todocs/assets/gallery/<name>.webp. It records each source PNG's SHA-256 indocs/assets/gallery/sources.json, so it is safe to rerun and skips files that are already up to date without relying on file modification times.docs/gallery.mdshows the web-sized image for each example with explicitwidthandheight,loading=lazyon all but the first image, and theno-lightboxskip class from the glightbox configuration inmkdocs.yml. Each image is wrapped in a link to the full-size PNG, so a click still opens the original. Every heading, anchor id, prompt, command and download link is unchanged; the diff touches only the twelve image lines.examples/graphs/README.mdgains one line telling contributors to run the script after adding an example.docs/index.mdwas checked and left alone: its six thumbnails are 67 to 98 kB each, all under the 150 kB threshold.Verification:
mkdocs buildpasses with no warnings, before and after./gallery/#...anchors linked from the README resolve in the built page.Checklist
All Submissions:
AI Assistance Declaration
scripts/make_gallery_images.py, generated the WebP images, rewrote the twelve image lines indocs/gallery.md, added the README line, and verified the build. Reviewed by the author.Checklist for Changes to Core Features:
🤖 Generated with Claude Code