Repository navigation
Conversation
vng
left a comment
There was a problem hiding this comment.
Review of the WebP migration. CI is green: Zola build, translations, DCO and Pages all pass.
Verified correct
- og:image sources are unchanged. I recomputed them for all 1,181 news Markdown files on master and on HEAD (explicit
preview_image→ parent cover → first sorted image) and found 0 changes. All referenced files still exist. - No in-repo link points to any of the 65 deleted originals.
Actionable (this PR)
base.htmlWebP→original swap is dead code: no real content triggers it. Drop it (inline)._news_media.html: drop thenews_image_variantcomponent and the alt fallback, which no content uses. Replace them with a single twin-membership skip, which also catches mistakes by failing the build (inline suggestion)._news_preview.html: the WebP parent cover isn't used. Revert it, or simplify the nested loop and flag (inline).test_redirect_limits_and_orderis left over from the removed redirect step and is out of scope here (inline).- Docs:
CLAUDE.md§ Preview Images (lines 212-214) still saysNNN-preview.jpgis "this exact filename convention". It also says "first JPEG/PNG/WebP asset". It needs the twin rule: a retained original stays the preview URL, and the gallery and Telegram show its WebP once. If the-preview.webpsupport stays, CLAUDE.md should mention it too. - Commits: the three commits describe intermediate states that no longer exist. 60f3cd9 mentions a "repeatable conversion tool" and a static derivative lookup, and 5353cf0 mentions "permanent redirects". Please squash them into one commit whose message describes only the final result: 65 originals replaced, 42 preview originals kept beside WebP twins, and no redirects.
Trade-off to confirm (not a bug)
- The 65 deleted JPEG/PNG gallery URLs now return 404, multiplied across every localized slug path. That fits the "no redirects" decision. Externally hot-linked or image-search-indexed copies will break, but that seems acceptable for gallery images.
No pre-existing issues found that need a separate PR.
Generated by Claude Code
Deploying organicmaps with
|
| Latest commit: |
7ca407b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5fdd6001.organicmaps.pages.dev |
| Branch Preview URL: | https://ab-webp.organicmaps.pages.dev |
vng
left a comment
There was a problem hiding this comment.
Review of 956a05e (rebased on master, 1 commit). I found no correctness issues. The three inline comments are optional: one fail-fast check and two docs cleanups.
Checked against master with Zola 0.23.4:
og:imageis identical on all 3,536 rendered pages. Theˋ<image:loc>ˋentries in the sitemap are identical too, so shared preview URLs keep working with no redirects.- None of the 65 deleted originals is referenced from
content/,templates/,static/ortools/. All 198 rendered/news/…image URLs resolve to files inpublic/. - Each of the 42 retained JPEG/PNG originals with a
.webpsibling is a currentog:image, so none is dead weight. Each of the 107 added WebP files is smaller than its original. tools/test_navigation.py(8 tests) andnpm testpass. CI is green.- The previous five review threads are already resolved, and their suggestions are reflected in the code. Nothing is left to resolve.
Inline (fix here, optional):
templates/_news_media.html:28: fail the build when a JPEG/PNG that has a WebP sibling isn't the sharing preview. This enforces the README's "no JPEG/PNG duplicates" rule. Verified: the build output is unchanged, and adding a stray duplicate fails the build.README.md:110-112: duplicate sentence, and the cover example still uses.jpgfor a new post.README.md:74-80: repeats the retained-preview and no-redirect rule from lines 59-63.
Pre-existing / out of scope: none worth a separate PR. The deleted gallery originals' old URLs now return 404. That matches the PR description, which keeps only the shared previews, and nothing in the site links to them.
Generated by Claude Code
| {#- Keep sharing previews published and show their WebP siblings in the gallery. -#} | ||
| {%- if extension != "webp" -%} | ||
| {%- set webp_path = (media | trim_end(pat=filename_extension)) ~ "webp" -%} | ||
| {%- if webp_path in resource.assets -%}{%- continue -%}{%- endif -%} |
There was a problem hiding this comment.
Optional fail-fast (new in this PR): README says "Do not add JPEG/PNG duplicates" for new posts, but nothing enforces it. A stray X.jpg next to X.webp is hidden here without any warning and still gets published. All 42 retained originals are currently the sharing preview: either the first image asset (first_image is still true when the hidden original is reached) or extra.preview_image (for example 630/02-bookmarks-tracks-multi-selection.jpg). Throwing for anything else turns the convention into a build check:
| {%- if webp_path in resource.assets -%}{%- continue -%}{%- endif -%} | |
| {%- if webp_path in resource.assets -%} | |
| {#- Only a published sharing preview may keep its original next to its WebP. -#} | |
| {%- if not first_image and filename != resource.extra | get(key="preview_image", default="") -%} | |
| {{- throw(message="'" ~ media ~ "' duplicates its WebP sibling and is not the sharing preview") -}} | |
| {%- endif -%} | |
| {%- continue -%} | |
| {%- endif -%} |
I checked this with Zola 0.23.4. Applied to this branch, the full build output is byte-identical (diff -rq is empty). Adding 630/03-hide-track-in-list.jpg next to its WebP fails the build. It's lenient in one case: a hidden first original in a post that also has a parent -preview cover. If you take it, add a negative subtest to test_navigation.py next to the invalid_alt_key cases.
Generated by Claude Code
Add 107 optimized WebP images, replacing 65 gallery originals and keeping 42 published JPEG and PNG previews alongside their WebP siblings. Serve the retained previews at their published URLs. Use the lowercase .webp sibling in news galleries and Telegram albums. Key image descriptions by the gallery filename. Allow dedicated WebP sharing covers and give existing JPEG covers priority. Verified with Zola 0.23.6, eight navigation tests, and npm test. Signed-off-by: Alexander Borsuk <me@alex.bio>
Left old image previews to avoid introducing redirects.