I’m trying to add img fingerprinting for cache-busting. The images are associated w/only a single page (in a leaf bundle), so I thought I would imply wrap img inside a shortcode that does fingerprinting, e.g.
{{< img "logos.gif" >}}
This seems to be straight-forward, and there’s an existing post suggesting that its possible:
However, I get an error when piping the page resource into resources.Fingerprint: shortcodes/img.html:8:41: executing "shortcodes/img.html" at <resources.Fingerprint>: error calling Fingerprint: resource.Resources is not a Resource.
Is the thinking pipelines can only be used to transform files in assets, moving them to resources/_gen?
Nevermind. I wasn’t extracting the array correctly; used first instead of index. Now it works fine!
But it begs this question: is there a better approach? This method essentially duplicates all the images into build (one copy w/o fingerprint, and one copy with).