I started using Hugo for my blog when Page Bundles weren’t quite mature. The idea seemed the most logical, but as far as I remember there were some issues with accessing images. I think one of them was the lack of support by NetlifyCMS. As a result, I ended up using what I believe is the classic structure.
- content
-- blog
--- post-1-title.md
--- post-2-title.md
While all the images for posts are stored in static/images.
I’ve decided to put small thumbnail images in post-list view to make it more visual (so it’s inside a range). Since these images are large, I wanted to process and resize them first.
I’ve read through the docs and forum threads and it seems to me that I can’t actually get images as a resource and run processing on them unless I remake all my content into bundles?
Can’t say I have hundreds of posts, but it’d still be a lot of work, and I don’t really need bundles for anything else.
So here are my two questions:
Do you know if DecapCMS actually supports them? I’m not sure.
It seems the latter option would actually allow me to avoid rebuilding anything as bundles?
I wasn’t sure if I can refer to global resources without the full URL scheme based on the documentation. If I can just mount the images folder into assets, and then still resource.GetMatch the file mentioned in the front matter, that would be enough.
Now I’m trying to get the resource for the image, but the result is just ‘nil’. The ‘with’ structure extracts the image from the front matter correctly, I’ve checked. Also, resources.GetRemote does actually retrieve the image (I used it with absURL), but for some reason, even if I build the link to it manually, it doesn’t work (when I checked the ‘/public’ I don’t actually see that image in the ‘/images’ folder for some reason).
{{ range after 1 .Paginator.Pages}}
{{ with .Params.image }}
{{ $image := resources.GetMatch ( . ) }}
{{ print $image }}
{{ end }}
{{ end }}