I would like to start using image post processing but my current structure is this (fig v1). So I need to move the images I want processed from static into the content folder.
I like this idea (fig v2), because it keeps all my media in one place. This seems to make sense to me - because I may want to reuse images in different articles/guides/reviews, and from what I have read I think this will work better than nested bundles with netlify cms - although they may have addressed the issue. (https://github.com/netlify/netlify-cms/issues/513).
However I don’t want url/media/name.jpg to be rendered in the browser. I added “headless: true” to the index.md in the media folder - so now url/media/ gets the 404 page but url/media/name.jpg still renders.
Furthermore it doesn’t seem that this is the intended proper way to work with image processing through page bundles. I am following (Image Processing Outside Folder thread) and @bep mentions some downsides of hacky workarounds. He also mentioned twice “Having images and content bundled together has lots of benefits”
Is this (fig v3) the proper structure to use for page bundles and image processing?
Will I still be able to reuse images in later articles/guides/reviews without forcing the user to download multiple copies?
What are the benefits of the page bundle approach, why is it superior?
That is a very old thread you linked to and it is outdated.
See the resources.Get method it’s faster than Page Bundles and you can keep your existing content organization. All you need is to create a symlink of the static folder into the assets folder or turn the static folder into the assets folder with the assetDir configuration option.
P.S. I’m on my mobile and about to go to a gallery opening. There are topics in the forum about the tips I gave you, look it up.
OK thanks. No rush on response - those one drawings a day must really be paying off!
So is page bundling just generally not the cool thing anymore, or specifically Hugo Pipes with resources.Get will allow me to use image processing for my current structure?
I am asking because I would rather change my understanding of proper content structure now than hacking together solutions for each new project.
Page Bundles have their use and they are perfectly cool. But resources.Get will indeed allow you to use image processing without altering your content organization and that is a time-saver.
I think that content structure depends on the project and also it’s a matter of preference. For example I have a project with 8 headless bundles directly under /content/ that have their contents loaded dynamically with Photoswipe from the index page.
You determined statig/img as your asset directory. So all relevant elements should be in there. The default is assets as root folder. You can define only one assetDir. You can symlink your static folder to assets.
Why don’t you create one headless bundle called media and put it at the root of your content/ dir. You can store all your “content” images there.
Then everytime you need an image, you just use {{ (.Get "media").Resources.GetMatch "whatever" }} or something much safer…
This the way I do it when I need my projects to have one common directory for images useable throughout any pages.
_index.md*
note: resources must be registered in the .md for their bundle, not the .md of the content intended for use. So this likely has to be manually updated with each new image thrown into the media folder.