I’m using Forestry as a CMS. Currently, they have a “flat” media manager (i.e. no folders, no page bundle support). This got me thinking about using
assets/. So I’m housing all images, etc. in
assets/media/ and dong some image processing in templates.
This seems to work. At least now.
My question is: am I going to run in trouble / am i doing something “un-Hugo-y”? or might this be the way to go, since Hugo Pipes seems to suggest that these asset transformations are in some regards similar?
Have you considered using the approach outlined in forestry docs?
It involves creating a “headless” bundle for uploads and accessing the images like this:
(site.GetPage “section” “uploads”).Resources.GetMatch (strings.TrimPrefix “/uploads/” $imagePath )
Other than the extra syntax and the fact that the image path is modified (so Bitbucket or Github doesn’t show the images in markdown correctly in repository preview) it works well for front-matter and page content images.
Using the assets folder directly seems to be very similar so I would expect it to work as well.
yeah, I am aware of the Forestry approach - which to me seems a little hackey? If we are committed to a workflow which uses image processing, it seems like the originals should be located in something like
assets/ or even
data/. Maybe i’m just splitting hairs or this is a purely aesthetic question…
@bep do you have an opinion?
I think that anything short of supporting Hugo page bundles and relative resources is hacky.
Aesthetically the section approach might be slightly better if you value content assets / design assets separation, because “uploads” section is stored under content folder and therefore is a bit “closer” to actual content. Using a subfolder in assets isn’t very different though.
Technically I see no difference since you can access the images pretty much the same way in both cases.