This works fine. But there are instances where I will also be using jpg images so I do not want to hardcode png into my code. I’ve tried using the .GetMatch function, but can’t get it to work. Not sure where to place the wildcard *.
Any suggestions on how to handle image format other than including a front matter param as per @zwbetz suggestion?
I have over 1000 markdown files and images so I was thinking there might be a better way. The reason I’m using the assets/images folder is because an image is going to be used in multiple sections, and I need to do image processing.
Well, the best way to benefit from image processing without assets is to create a Page Bundle to store all your images.
You can name it uploads and store it as content/uploads/index.md. By setting the FM parameter headless to true, you make sure hugo will not publish this Upload page, but its resources: yes.
Once you’ve moved all your images to this upload directory, they become Page Resources subject to .Match, .GetMatch, etc…