feat(carousel): serve slide images from media, add picker to settings - #142
Merged
Conversation
The homepage carousel defaults pointed at /images/PodcastBanner.webp and friends -- files bundled in Scalene's public/images. Those paths could not be changed from the CMS, so editing a banner meant a Scalene commit and redeploy, which defeats the point of a CMS-editable carousel; a rename on the Scalene side broke the slide with nothing in the CMS to show for it. The settings field was also plain text with no preview, and a root-relative /images/... would have resolved against the CMS origin, which serves nothing there. Copy the three banners to the media filesystem under wp-content/uploads/scalene/ and repoint the defaults at them. The prefix sits under wp-content because that is the only tree Nginx serves, and outside the YYYY/MM layout so the legacy WP corpus stays separate. Replace the Image URL input with a thumbnail plus the existing MediaPicker modal, so slides can be pointed at library media or a fresh upload. The raw URL input stays for external URLs and for the empty-image_url case that drives Scalene's "100 Years" text slide. No cms_settings row for homepage_carousel exists yet, so the defaults are what the public homepage actually serves and no data migration is needed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
The homepage carousel defaults pointed at
/images/PodcastBanner.webp,/images/classifiedsBannerNew.webp, and/images/applyBannerNew.webp— files bundled in Scalene'spublic/images/, duplicated verbatim inBanner.astro's own fallback list.<img>, with nothing in the CMS aware of it./images/...resolves against the CMS origin, which serves nothing there.Changes
Images moved to the media filesystem. The three banners now live at
/mnt/cephfs/media/wp-content/uploads/scalene/and the Go defaults point at them viadefaultCarouselImageBase. The prefix sits underwp-content/because that is the only tree Nginx roots (deploy/nginx/triangle-cms.conf) — a top-level dir would fall through to the frontend proxy and 404 — and outside theYYYY/MMlayout so the legacy WP corpus stays visibly separate.Media picker in settings. The
Image URLinput becomes anImagefield with a thumbnail, a Choose/Replace button opening the existingMediaPickermodal (search + upload, same as the article editor), and Clear. The raw URL input stays for external URLs and for the empty-image_urlcase that drives Scalene'sone-hundred-slidetext slide.Notes
GET /v1/homepagereturns a carousel byte-identical to the Go defaults, so nocms_settingsrow exists forhomepage_carouselyet — the defaults are what the public homepage actually serves.200 image/webpat the expected sizes./wp-content/block stampsmax-age=2592000, immutable, which assumes a filename pins its bytes — true for WP's size-suffixed derivatives, not for these. Replace under a new name and repoint the slide. Documented in a comment above the const.POST /v1/media), so they serve fine but won't appear in the MediaPicker grid until a "Reindex Media" run.Banner.astro's duplicateddefaultSlidesis intentionally untouched — it still falls back to the/images/paths if the CMS returns an empty carousel.Testing
go build,go vet,gofmt,go test -count=1 ./internal/...,tsc --noEmit, andnpm run buildall pass on this branch's base.🤖 Generated with Claude Code