Repository navigation
feat(gallery): photo gallery page from posts' image-host links - #7
Merged
Merged
Conversation
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.
Deploying astropages-bilingual with
|
| Latest commit: |
8caa0ff
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3a7bc820.astropages-bilingual.pages.dev |
| Branch Preview URL: | https://feat-gallery.astropages-bilingual.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an opt-in photo gallery at
/gallerythat collects images from posts markedgallery: truein their frontmatter — no separate image list to maintain, the photos come straight from your travelogues'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.mjsencodes 800px AVIF thumbnails withsharpand extracts a privacy-safe EXIF subset withexifr(GPS is never extracted). It falls back toavifdec/ ImageMagick for 10-bit AVIF that sharp's prebuilt libaom can't decode..github/workflows/gallery.ymlre-runs it on post changes and commits the thumbnails + manifest back tomain. 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,/gallery404s, and it's excluded from the sitemap.Ships a bilingual
gallery-demopost 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
Checklist
Further comments
Verified with
pnpm lint,pnpm format:check, andpnpm 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).