I have a Hugo site that uses a number of images. Generally speaking, when I’m in a development environment, I want to use <Hugo site root>/assets/images/[image] as the path for the image. When I’m in production, I want to serve that asset from an S3 bucket instead, from <S3 bucket URL>/assets/images/[image].
What’s the right way to do this throughout my site:
Copy-pasting {{ if ... }} blocks everywhere to check for environment (hoping it’s not this!)
Write an image-handling shortcode to handle the {{ if ... }} check and use the shortcode everywhere