Skip to content

Fix news media rendering and archive image loading - #376

Merged
biodranik merged 1 commit into
masterfrom
fix/news-media-rendering
Nov 16, 2026
Merged

biodranik merged 1 commit into
masterfrom
fix/news-media-rendering

Conversation

@biodranik

@biodranik biodranik commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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.

  • Normalize extensions, sort filenames and render MP4 players. Unsupported gallery assets stop the build with an actionable error; audio embedded in article text keeps a single player.
  • Reserve image dimensions, use async decoding, and lazy-load listing/archive images. Listing/archive videos preload metadata to preserve their previews and dimensions; articles keep autoplay and prioritize their first image.
  • Support localized extra.media_alt descriptions, including explicit empty descriptions for decorative images. Images without a media_alt entry 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.
  • Correct the listing's nested div/section closing order and document the component, translation and media-format conventions. Standalone Telegram folders retain MOV/M4A attachment discovery.

Validation:

  • Full Zola build, all 8 navigation tests and all 27 tooling tests pass from a clean checkout.
  • English/German regressions cover all three views, mixed-case extensions, portrait-only and landscape layouts, encoded filenames, alt-text escaping, unsupported formats and invalid description keys.
  • Audit of 2,054 rendered pages verifies all 12,734 gallery image references and 972 video references resolve, with image inventories and listing layouts preserved.
  • Chromium measurements confirm metadata preloading restores all 11 listing videos to their dimensions on master, avoiding blank 300×150 players.
  • Reproduced the original uppercase-MP4 build failure and both validation gaps before their fixes.
  • Standalone MOV and M4A dry runs confirm attachment discovery without API requests.
  • Missing-alt regressions cover six omission cases, including absent frontmatter and decorative entries; explicit empty descriptions and translation_keeps_source declarations remain valid. The CLI reports these omissions as warnings without failing publication.

@biodranik
biodranik requested a review from vng November 16, 2026 19:16
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Deploying organicmaps with  Cloudflare Pages  Cloudflare Pages

Latest commit: 58d1149
Status: ✅  Deploy successful!
Preview URL: https://a1c7039f.organicmaps.pages.dev
Branch Preview URL: https://fix-news-media-rendering.organicmaps.pages.dev

View logs

@vng vng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 build succeeds and all 8 tools/test_navigation.py tests 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/height attributes do not distort images: the global img { height: auto } keeps the aspect ratio under the max-width/max-height caps (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_image for the first entry only would avoid delaying it.
  • The image-extension list ["jpg", "jpeg", "png", "webp"] now appears in base.html and twice in _news_media.html. Finding 4 removes one copy.

There were no earlier review threads or comments to resolve.


Generated by Claude Code

Comment thread templates/_news_media.html Resolved
Comment thread templates/_news_media.html Resolved
Comment thread templates/_news_media.html Resolved
Comment thread templates/news/list.html Resolved
Comment on lines +15 to +17
<span class="news_images">
{{ <news_media resource={page} /> }}
</span>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread README.md Resolved
Comment thread tools/test_navigation.py Resolved
@biodranik
biodranik force-pushed the fix/news-media-rendering branch from ec9750f to 56cdfc3 Compare November 16, 2026 19:29
@biodranik
biodranik requested a review from vng November 16, 2026 19:30

@vng vng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py tests pass.
  • Chromium, /news/, the 2026-11-11 archive and its article, at 1280px and 390px, master against this branch: none of the 198 listing images is distorted by the new width/height attributes (the global img { height: auto } keeps the ratio).
  • The 2026-11-11 archive no longer scrolls horizontally at 1280px (2334px on master, 1280px here).
  • translate_check.py warns on a copied extra.media_alt value, stays quiet for an empty description, and accepts translation_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

  1. Fix here (small): tools/telegram_post_all.py still accepts .mov and .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.
  2. 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

Comment thread README.md Resolved
@biodranik
biodranik force-pushed the fix/news-media-rendering branch from 56cdfc3 to c3ed9f2 Compare November 16, 2026 21:44
@biodranik
biodranik requested a review from vng November 16, 2026 21:45

@vng vng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py tests 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_Store in a news folder does not trip the new "Unsupported news asset" error (ignored_content already excludes it).
  • Titles contain no HTML entities or tags, so the title fallback in alt is not double-escaped.

Earlier threads

  • Resolved as fixed: the README wording on the per-image title fallback.
  • The .mov/.m4a finding 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 replacing news_has_landscape, and a shared news_entry component.

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

Comment thread templates/_news_media.html Resolved
Comment thread README.md Resolved
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>
@biodranik
biodranik force-pushed the fix/news-media-rendering branch from c3ed9f2 to 58d1149 Compare November 16, 2026 22:10
@biodranik
biodranik requested a review from vng November 16, 2026 22:11

@vng vng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of 58d1149. No blocking issues found.

Checked on this commit (Zola 0.23.4)

  • Full site build, all 8 tools/test_navigation.py tests and all 27 tmp/test_tooling.py tests pass. translate_check.py --all reports 1866/1869 pages clean; no page in the corpus has media_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-alt warning 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 replacing news_has_landscape, and a shared news_entry component. 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.png is emitted as /news/…/d.png while 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

Comment thread README.md
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs (fix here, wording only): describe the behavior, not its history.

"Keep" only makes sense to someone who knows the earlier article template.

Suggested change
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) %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@biodranik
biodranik merged commit 57fb233 into master Nov 16, 2026
4 checks passed
@biodranik
biodranik deleted the fix/news-media-rendering branch November 16, 2026 22:19

This branch was successfully deployed

1 active deployment
production — 58d11493 Deployed Nov 16, 2026 by biodranik via Check Zola build #1284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants