Skip to content

feat(gallery): photo gallery page from posts' image-host links - #7

Merged
t0saki merged 1 commit into
mainfrom
feat/gallery
Jul 7, 2026
Merged

t0saki merged 1 commit into
mainfrom
feat/gallery

Conversation

@t0saki

@t0saki t0saki commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Description

Adds an opt-in photo gallery at /gallery that collects images from posts marked gallery: true in their frontmatter — no separate image list to maintain, the photos come straight from your travelogues' ![alt](url) image-host links. Albums are grouped per post (the title links back), photos show EXIF (camera / lens / settings) on hover, and open in a PhotoSwipe lightbox.

Thumbnails and EXIF are pre-generated into the repo so the site build downloads and transcodes nothing:

  • scripts/generate-gallery-thumbs.mjs encodes 800px AVIF thumbnails with sharp and extracts a privacy-safe EXIF subset with exifr (GPS is never extracted). It falls back to avifdec / ImageMagick for 10-bit AVIF that sharp's prebuilt libaom can't decode.
  • .github/workflows/gallery.yml re-runs it on post changes and commits the thumbnails + manifest back to main. That bot commit triggers a second build (the "double build") — new photos fall back to their original URL until the thumbnail lands, a window of a few minutes.

Frontend: a CSS-only justified grid, a three-line hover overlay (caption / camera + lens / shooting parameters), a localized PhotoSwipe UI with a fully-opaque backdrop, and a view-transition-safe init/destroy lifecycle. The feature is gated by features.gallery — when disabled, the nav item disappears, /gallery 404s, and it's excluded from the sitemap.

Ships a bilingual gallery-demo post pair using 6 CC-licensed Wikimedia Commons photos (attribution in the post body) so the feature is live out of the box.

Types of changes

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Documentation Update (if none of the other choices apply)
  • Others (any other types not listed above)

Checklist

  • I have read the Contributing Guide
  • I have added the necessary documentation (if appropriate)
  • Breaking Change (fix or feature that would cause existing functionality to not work as expected)

Further comments

Verified with pnpm lint, pnpm format:check, and pnpm build (astro check strict TS + pagefind), plus browser checks in both light and dark themes: justified layout, hover overlay, lightbox (open / keyboard nav / localized titles / Esc), the missing-thumbnail fallback, and the feature-disabled path (404 + nav removal + sitemap exclusion).

Thumbnail generation is deliberately kept out of the site build because sharp's prebuilt libaom cannot decode high-bit-depth AVIF; moving it to a committed-artifact + CI step keeps the Cloudflare Pages build fast and pure-static. Cloudflare Image Transformations were rejected (no AVIF input support).

Adds an opt-in /gallery page that collects images from posts marked
`gallery: true`, grouped per post (title links back), with EXIF shown
on hover and a PhotoSwipe lightbox.

- Config: `features.gallery` (enabled + imageDomains whitelist); `gallery`
  frontmatter flag; bilingual pages mirroring the archives pattern.
- Thumbnails + EXIF are pre-generated into the repo by
  scripts/generate-gallery-thumbs.mjs (sharp encode; exifr, GPS never
  extracted; avifdec/ImageMagick fallback for 10-bit AVIF) and refreshed
  in CI by .github/workflows/gallery.yml — a bot commit that triggers a
  second build. Missing thumbnails fall back to the original image.
- CSS-only justified grid; three-line overlay (caption / camera+lens /
  settings); localized PhotoSwipe UI; view-transition-safe lifecycle.
- Demo: bilingual gallery-demo posts with 6 CC-licensed Wikimedia photos.

Verified: lint, format, astro check + build; both light/dark themes,
lightbox, hover, fallback, and the feature-disabled (404 + nav + sitemap)
path in the browser.
Copilot AI review requested due to automatic review settings July 7, 2026 14:19

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying astropages-bilingual with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8caa0ff
Status: ✅  Deploy successful!
Preview URL: https://3a7bc820.astropages-bilingual.pages.dev
Branch Preview URL: https://feat-gallery.astropages-bilingual.pages.dev

View logs

@t0saki
t0saki merged commit e4a6fe7 into main Jul 7, 2026
2 checks passed
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