Is it possible to use Hugo 0.32’s new image processing feature for images in other folders?
For example, I have a site that is already structured in a format with all media in a separate /content/images folder, instead of beside each entry as a page bundle.
I made a simple example repo of this Here and also answered your SO here
In summary, it is possible to access a sections image resources from another page or location in the content.
For your example:
Add a content/images/_index.md file to be able to access the section (not sure if this is optional or not) then access the section for the resources inside your layout templates. You should also be able to access them from within a shortcode similar to in the docs.
Yep, small price to pay. I would just redirect it anyway.
I do think there are some issues with the local hugo server, but need to test it out. Published site works like a charm, so no problem there.
Opinion: I would have liked this to be a static dir location rather than just requiring them to be in a pages resource location. I see no advantages to not having a resources static location for images, etc., but maybe it is a requirement of the way go is handling them.
@alexandros Like @talves suggested above, is there any technical reason why media cannot be stored in a separate folder by default, or is this simply a decision?
I guess in this solution we are setting up a media folder location for the image resources to be accessed from within the templates. I am happy with this requirement at the moment. It solves all my needed use cases.
@tech4him I think it has something to do with the Resources context of the image file to be able to get the parameter values from a resource, but @bep or others will definitely know better.
Not sure if you know, but you can access the exact width and heigth of an image resource.
Yes, I’m fine with using it as you’ve explained. I’m just wondering if this was a technical consideration, or simply a new structure that the Hugo team sees as more useful in the long run.
@tech4him and @talves Hugo 0.32+ also supports folder symbolic links.
I haven’t tested them yet, but I would think that you can use this to store your media library under /static/ and have its symbolic link under /content/
Apparently he developed a workaround to use Image Processing outside Page Bundles by using a /content/media folder for images . I haven’t tested it yet. But it seems interesting.
Yeah, This I understand. Just discussing the alternative use cases as in the example of Netlify’s CMS requirements to manage a media folder in one place.