Before posting this to GitHub Discussions, I wanted to get feedback here. I know the feature backlog is long and this might be a small fish in a big pond, but it’s been on my mind.
Tagging @bryantgillespie, since this feels like something that could impact front-end performance and SEO, and he seems to be the lead on the front-end CMS work.
The Problem
Google often indexes image URLs like:
/assets/c68b2295-fc7f-4a46-9c0b-0270910f6897/filename.jpg?key=optional-key
It tends to strip the key, exposing the original full-res file via Image Search. That drives up our S3 egress costs and exposes files we don’t want publicly served at full quality.
Of course, users can also remove the key manually (or programmatically) and scrape the site’s entire image library.
We want to keep originals for future use, but ideally serve optimized versions by default.
The Idea
A way to enforce a default image preset when no preset is explicitly provided. This could be based on:
-
Collection
{ "collection": "products", "field": "product_image", "default_preset": "thumbnail" } -
Folder
{ "folder": "public-assets", "default_preset": "web-optimized" } -
Tag
{ "tag": "publicly_served", "default_preset": "compressed" } -
Global Default
{ "default_preset": "safe-default" }
Could This Be Done Using Roles?
Is there a way to use user roles to enforce presets for public or anonymous access?
{ "role": "public", "default_preset": "low-res" }
If that’s already possible, I might just be missing it.
Could This Be an Extension?
It feels like this could also be handled with a hook that inspects the request and rewrites the asset URL with a preset automatically—based on folder, tags, or user role.
Would love to know if anyone else has run into this or solved it another way. Happy to open a GitHub request if there’s interest.