Repository navigation
Fix news media rendering and archive image loading - #376
Conversation
Deploying organicmaps with
|
| Latest commit: |
58d1149
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a1c7039f.organicmaps.pages.dev |
| Branch Preview URL: | https://fix-news-media-rendering.organicmaps.pages.dev |
vng
left a comment
There was a problem hiding this comment.
No blocking defects found. The change does what the description says; the inline comments are two fail-fast gaps, one UX trade-off to decide, and optional simplifications.
Verified locally (Zola 0.23.4, head ec9750f, already on top of master)
zola buildsucceeds and all 8tools/test_navigation.pytests pass. The GitHub build and markdown checks were still queued when I reviewed./news/initial media requests in Chromium drop from 198 images + 19 MP4 requests on master to 9 images and no video./news/2026-11-11/no longer overflows horizontally (2334px wide on master at a 1280px viewport).- The listing keeps the same 32 wide-image (
_noflex) entries as master. - The new
width/heightattributes do not distort images: the globalimg { height: auto }keeps the aspect ratio under themax-width/max-heightcaps (checked rendered sizes).
Findings
| # | Where | Finding | Scope |
|---|---|---|---|
| 1 | _news_media.html:29 |
Unsupported assets (.mov, .m4a, .gif, …) are dropped silently; stop the build instead |
Fix here |
| 2 | _news_media.html:23-26 |
A mistyped or stale media_alt key is ignored silently; validate keys and simplify the lookup |
Fix here |
| 3 | _news_media.html:18 |
preload="none" shows blank 300×150 players in the listing and archive |
Decide here |
| 4 | list.html:24 |
One :has() rule can replace news_has_landscape and the second metadata pass |
Optional |
| 5 | date_section.html |
Archive entries still lack the title, dir="auto" and wide-image layout of listing entries |
Pre-existing, separate PR |
| 6 | README.md:64, CLAUDE.md |
Mention the existing translate_check.py warning; add extra.media_alt and the component location to CLAUDE.md |
Fix here |
| 7 | test_navigation.py |
The listing's _noflex container class is untested |
Fix here |
Not anchored to a line (optional)
- The first image of the first listing entry is above the fold on desktop and now loads lazily. Passing
eager_first_imagefor the first entry only would avoid delaying it. - The image-extension list
["jpg", "jpeg", "png", "webp"]now appears inbase.htmland twice in_news_media.html. Finding 4 removes one copy.
There were no earlier review threads or comments to resolve.
Generated by Claude Code
| <span class="news_images"> | ||
| {{ <news_media resource={page} /> }} | ||
| </span> |
There was a problem hiding this comment.
Alternative (mostly pre-existing, optional separate PR): share the whole post entry, not only its media.
This change is a clear improvement: on master /news/2026-11-11/ scrolls horizontally to 2334px at a 1280px viewport, and here it fits.
The archive entry still differs from the listing entry for the same post: it has no post title, no dir="auto" for untranslated posts, and no wide-image layout. Moving the listing's per-post block (date, title, content, media) into one news_entry component used by both list.html and date_section.html would remove those differences and the duplicated translation lookup.
Con: the archive would gain a title and the taxonomy section wrapper, which is a visible change that deserves its own review.
Generated by Claude Code
ec9750f to
56cdfc3
Compare
vng
left a comment
There was a problem hiding this comment.
Re-review of 56cdfc3. No blocking issues found.
Checked on this commit (Zola 0.23.4)
- Full site build and all 8
tools/test_navigation.pytests pass. - Chromium,
/news/, the2026-11-11archive and its article, at 1280px and 390px, master against this branch: none of the 198 listing images is distorted by the newwidth/heightattributes (the globalimg { height: auto }keeps the ratio). - The
2026-11-11archive no longer scrolls horizontally at 1280px (2334px on master, 1280px here). translate_check.pywarns on a copiedextra.media_altvalue, stays quiet for an empty description, and acceptstranslation_keeps_source: ["extra.media_alt.<file>"].
Earlier threads
Resolved as fixed: unsupported assets stop the build, stale media_alt keys stop the build, preload="metadata", the docs updates, and the listing layout assertion. The two optional threads stay open for a decision: the :has() rule replacing news_has_landscape, and a shared news_entry component.
New findings
- Fix here (small):
tools/telegram_post_all.pystill accepts.movand.m4a.MEDIA_EXTENSIONS(line 58) lists both, but a news folder holding either now fails the site build, so those two entries can never match a publishable post. Dropping them keeps the tool and the site agreeing on one set of formats. The alternative is rendering them on the site, which nothing in the corpus needs. - Fix here: README wording, see the inline suggestion.
Pre-existing, optional separate PR
/news/scrolls horizontally at 390px (419px wide) on master and here. The cause is an unbreakable<code>path (/data/data/app.organicmaps.app/files/settings.ini) in an old post;code { overflow-wrap: anywhere; }would contain it.
Generated by Claude Code
56cdfc3 to
c3ed9f2
Compare
vng
left a comment
There was a problem hiding this comment.
Re-review of c3ed9f2. No blocking issues found; CI is green.
Checked on this commit (Zola 0.23.4)
- Full site build and all 8
tools/test_navigation.pytests pass. - Master against this branch, all rendered pages: every gallery image and video reference resolves to a file. The article and listing image and video lists are unchanged; the only differences are in date archives, where MP4 and MP3 files are no longer emitted as
<img>. - A stray
.DS_Storein a news folder does not trip the new "Unsupported news asset" error (ignored_contentalready excludes it). - Titles contain no HTML entities or tags, so the title fallback in
altis not double-escaped.
Earlier threads
- Resolved as fixed: the README wording on the per-image title fallback.
- The
.mov/.m4afinding from the previous review is answered by the README note that only standalone Telegram folders may use them. No further change needed. - Still open for a decision, both optional: the
:has()rule replacingnews_has_landscape, and a sharednews_entrycomponent.
New findings
| # | Where | Finding | Scope |
|---|---|---|---|
| 1 | _news_media.html:29 |
Add a comment on why MP3 is accepted but renders nothing (suggestion inline) | Fix here, small |
| 2 | README.md:66-68, translate_check.py |
A translation that omits media_alt entries passes the check and silently uses the title |
Optional, here or separate PR |
Pre-existing, optional separate PR
- The listing emits an empty
<span class="news_images">for the 79 posts without media, and the date archive now does the same. It is harmless; wrapping the span in{% if page.assets %}would drop it.
Generated by Claude Code
Share sorted, case-insensitive media rendering across articles, listings and date archives. Reserve image dimensions, defer archive images, and preload video metadata so players keep correct sizes before playback. Support localized image descriptions with a title fallback. Fail builds on unsupported gallery assets and stale description keys, and warn when translations omit descriptions or decorative markers. Cover English and German media, metadata validation and portrait-only layouts. Signed-off-by: Alexander Borsuk <me@alex.bio>
c3ed9f2 to
58d1149
Compare
vng
left a comment
There was a problem hiding this comment.
Re-review of 58d1149. No blocking issues found.
Checked on this commit (Zola 0.23.4)
- Full site build, all 8
tools/test_navigation.pytests and all 27tmp/test_tooling.pytests pass.translate_check.py --allreports 1866/1869 pages clean; no page in the corpus hasmedia_alt, so the new warning adds nothing to that report. - Build time is unchanged: four alternating builds gave 6.8–8.5s on master and 6.7–7.3s here, so the listing's second metadata read per image is not measurable.
- The "Check Zola build" job was still running when I reviewed; the markdown/translation check and DCO are green.
Earlier threads
- Resolved as fixed: the comment explaining the MP3 branch, and the
missing-media-altwarning for translations that omit an English entry (it also fires when the translation has no frontmatter at all, and stays a warning). - Still open for a decision, both optional: the
:has()rule replacingnews_has_landscape, and a sharednews_entrycomponent. Neither changed in this commit.
New findings
| # | Where | Finding | Scope |
|---|---|---|---|
| 1 | README.md:51 |
"Articles keep their first image eager" describes history, not behavior (suggestion inline) | Fix here, wording |
| 2 | _news_media.html:26 |
The title fallback repeats the post title as alt on every image, right after the same heading; a non-string description renders as is |
Optional, decide here or separately |
Pre-existing, optional separate PR
- An image in a subfolder of a news post gets a broken URL. The renderer keeps only the last path segment, so
1/sub/d.pngis emitted as/news/…/d.pngwhile Zola copies it to/news/…/sub/d.png(I built this case). Master did the same, and no post has a subfolder today. Either build the URL from the path below the post folder, or stop the build for nested assets. - Still open from the first review: the first image of the first listing entry is above the fold on desktop and loads lazily.
Generated by Claude Code
| are sorted and extensions are case-insensitive. MP4 files render as videos; | ||
| MP3 files can be embedded in the text with the `audio` component. Other file | ||
| types stop the build. Images reserve their dimensions and use async decoding; | ||
| listing and archive images load lazily. Articles keep their first image eager. |
There was a problem hiding this comment.
Docs (fix here, wording only): describe the behavior, not its history.
"Keep" only makes sense to someone who knows the earlier article template.
| listing and archive images load lazily. Articles keep their first image eager. | |
| listing and archive images load lazily. Articles load their first image eagerly. |
Generated by Claude Code
| {%- elif extension in ["jpg", "jpeg", "png", "webp"] -%} | ||
| {%- set meta = get_image_metadata(path=media) -%} | ||
| {%- set_global image_filenames = [...image_filenames, filename] -%} | ||
| {%- set alt = alts | get(key=filename, default=resource.title) %} |
There was a problem hiding this comment.
Accessibility trade-off (optional, decide here or separately): the title fallback repeats the heading for every image.
No post has media_alt yet, so in the built /news/ all 198 gallery images carry their post title as alt. One post repeats a 190-character title 9 times, directly after the <h1> with the same text. A screen reader announces all of them. Accessibility checkers such as WAVE report this as redundant alternative text.
It is still better than master, where the images had no alt at all, so this does not block the change. Options:
- Keep it. Every image is announced, and the repetition goes away as posts gain
media_alt. - Fall back to
alt=""where the title is already next to the gallery (article and listing), and keep the title in the date archive, which has no heading per post. Con: an undescribed screenshot is then hidden from screen readers in those two views, and the component needs one more argument.
A smaller, separate point on the same line: a non-string value is rendered as is. I built a post with "b.png": 5 and got alt="5"; translate_check.py only reads string values, so it does not report it either. A bare "a.png": already stops the build with a frontmatter error.
Generated by Claude Code
Date archives render attached video and audio files as images, while the news listing loads its images eagerly without reserved dimensions. Share media rendering across articles, listings and date archives so these views handle the same assets consistently.
extra.media_altdescriptions, including explicit empty descriptions for decorative images. Images without amedia_altentry fall back to their localized article title. Stale, mistyped or non-image keys stop the build. Translation checks warn when a source image description or decorative marker is omitted.div/sectionclosing order and document the component, translation and media-format conventions. Standalone Telegram folders retain MOV/M4A attachment discovery.Validation:
translation_keeps_sourcedeclarations remain valid. The CLI reports these omissions as warnings without failing publication.