Skip to content

Restore the 19 gallery images the conversion dropped - #44

Merged
ptr727 merged 1 commit into
developfrom
restore-lost-gallery-images
Aug 7, 2026
Merged

Restore the 19 gallery images the conversion dropped#44
ptr727 merged 1 commit into
developfrom
restore-lost-gallery-images

Conversation

@ptr727

@ptr727 ptr727 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #43, which added the gate that measures this. The gate reported 120 orphans; this restores 17 of them to the pages they belong on.

What was lost, and why

Five gallery shortcodes across three posts were emitted empty. The ESP32 post announced:

Below are pictures of the finished case and the utility meters:

and then rendered <div class="gallery gallery-cols-4"></div>.

The cause is specific: WordPress used Gutenberg's wp-block-gallery with nested <figure> elements, and wp2hugo wrote the wrapper while dropping what it wrapped. gallery is the only shortcode this happens to.

Where the images came from

The captured live site, not a guess. The WordPress export XML does not carry these post bodies, so the crawl under mirror/ is the authoritative source. It holds each gallery's nested figures in document order, with their widths and captions. All 19 files were already on disk, so nothing was refetched, and three captions came back with them.

Membership genuinely was not inferable from this repo — and it would have been guessed wrong. The ESP32 gallery opens with a photo from 2018 and one from 2020, older images reused in a 2021 post, where the obvious guess was the sequential camera run from that month. Those two were already linked from their own original posts, which is why the orphan count falls by 17, not 19.

Scope is exactly these five

A count comparison across all 19 posts holding galleries: every populated gallery matches the mirror exactly, and only the five empty ones differ.

Post Hugo Mirror Delta
esp32-water-and-gas-utility-meter [0] [4] +4
installing-flair-smart-vents... [0,2,3,0,3,2,2,3,0,3,2] [4,2,3,4,3,2,2,3,4,3,2] +12
halloween-pumpkins-and-lights [2,0,3,2] [2,3,3,2] +3

The comparison has a blind spot worth stating, because it produced a wrong answer first: a mirror page parsed as having fewer figures than the markdown means the parser missed that page's markup, not that images were lost. Only a surplus in the mirror is a finding. Regex could not read nested figures at all and reported a fictional 194-figure loss; the stdlib HTML parser gives the real 19.

The ratchet worked

ORPHANED_MEDIA falls 120 -> 103 in this same change, because the gate demanded it rather than because I edited it alongside:

orphans: 103 of 1048 carried media files are linked from no page
         expected 120 - media was linked from a page, or orphaned files were removed;
                        lower ORPHANED_MEDIA to 103 in this change rather than leaving the slack
FAIL orphans

That is #43 earning its place one PR after landing.

Verification

Released to the local mirror and checked live, since this touches content/:

  • assets rises 1012 -> 1031, matching the 19 restored references exactly.
  • orphans falls to 103; parity PASS.
  • PASS - 1245 URLs honored, rules confirmed from the release just installed.
  • The restored images answer 200 on the running mirror.
  • The ESP32 gallery now renders four figures where it rendered none.
  • markdownlint, editorconfig-checker, and the module compile all clean.

What remains

103 orphans, cause unknown per file — a mix of further conversion losses and uploads the old platform never published. This repo cannot tell those apart; the capture can, by generalizing the comparison above. TODO.md records that, along with the parser blind spot so the next attempt does not repeat the 194 mistake.

One visible consequence to expect: the flair gallery at cols="5" holds 4 images, so with the 20% width from #41 it now occupies 80% of the row rather than filling it. That is the column count the author set in WordPress, and columns-5 is what the mirror carries, so the markup is faithful.

🤖 Generated with Claude Code

Five gallery shortcodes across three posts were emitted empty. The ESP32 post
announced "Below are pictures of the finished case and the utility meters:" and
rendered an empty div. wp2hugo wrote the wrapper and dropped what it wrapped:
WordPress used Gutenberg's wp-block-gallery with nested figures, and only the
outer element survived the conversion.

The images were recovered from the captured live site rather than guessed. The
WordPress export XML does not carry these post bodies, so the crawl under
mirror/ is the authoritative source, and it holds each gallery's nested figures
in document order with their widths and captions. All 19 files were already on
disk, so nothing was refetched. Three captions came back with them.

Membership was not inferable from this repo, which is why the earlier note said
so. It would also have been guessed wrong: the ESP32 gallery opens with a photo
from 2018 and one from 2020, both older images reused in a 2021 post, where the
obvious guess was the sequential camera run from that month. Two of the 19 were
therefore already linked from their own original posts, which is why the orphan
count falls by 17 rather than 19.

A count comparison across all 19 posts holding galleries confirms the scope is
these five and no others: every populated gallery matches the mirror exactly,
and only the five empty ones differ. The comparison has a blind spot worth
stating, since it produced a wrong answer first: a mirror page parsed as having
fewer figures than the markdown means the parser missed that page's markup, not
that images were lost, so only a surplus in the mirror is a finding. Regex could
not read nested figures at all and reported a fictional 194-figure loss; the
stdlib HTML parser gives the real 19.

ORPHANED_MEDIA falls 120 -> 103 in the same change, which is the ratchet working
rather than an edit alongside it: the gate failed at 120 and named 103.

Verified on the mirror. assets rises 1012 -> 1031, matching the 19 restored
references exactly; orphans falls to 103; PASS - 1245 URLs honored; the restored
images answer 200; and the ESP32 gallery now renders four figures where it
rendered none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 02:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Restores missing image references inside previously-empty gallery shortcodes in imported Hugo post content, and updates the orphan-media baseline/notes so the URL-parity gate reflects the newly linked media.

Changes:

  • Re-populates five previously-empty galleries across three posts with the correct figure entries.
  • Updates ORPHANED_MEDIA baseline from 120 → 103 to reflect the restored references.
  • Refreshes TODO.md to reflect the reduced orphan count and the current investigation approach.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TODO.md Updates the open decision note to reflect the new orphan baseline (103) and current attribution plan.
content/posts/2022/10/31/halloween-pumpkins-and-lights.md Restores 3 missing gallery images to the previously-empty gallery block.
content/posts/2022/10/30/installing-flair-smart-vents-to-keep-room-temperatures-balanced.md Restores images into three previously-empty galleries within the post.
content/posts/2021/08/09/esp32-water-and-gas-utility-meter.md Restores 4 images into the previously-empty gallery referenced by the post prose.
checks/check-url-parity.py Lowers ORPHANED_MEDIA baseline to 103 and updates the accompanying explanation comment.

@ptr727
ptr727 merged commit 002cad8 into develop Aug 7, 2026
5 checks passed
@ptr727
ptr727 deleted the restore-lost-gallery-images branch August 7, 2026 02:38
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