Normally, I would place all images in
static, but with the introduction of bundles I’m looking for input on this.
Consider the following two structures:
The use case would be to have a company page about Microsoft and show their logo, and on the Microsoft Surface page also show the logo. Which structure is preferable when an image is to be used by two or more sections?
I don’t believe there is a better option between the two. It depends on your long term plans for media, and how you reference them in your templates/archetypes.
Thanks. Can you elaborate on this please? What should I consider in deciding between the two?
One of the advantages of images that live under page bundles is you can do image processing on them, which you cannot do if they live under
I’ve seen some folks make a bundle just for shared images, then use templates or shortcodes to reference a given shared image in their other content.
Call it from a partial in your templates. If you need it to be a Resource place it under
/assets/ or whatever you prefer with the
assetDir parameter and then fetch it on the fly with the method
It’s the fastest and most economical way of calling an image multiple times in a Hugo project.
Thanks @zwbetz and @alexandros for the helpful comments.