Closed CapacitorSet closed 1 month ago
I don't think this is possible with Hugo. Because of the way Hugo works, the files in public
need to be copies, so regardless what happens in content
the files need to stay the same (and thus, hardlinks will not work).
Skipping the files altogether neither works, because the original files are referenced in the rendered site, they are opened when you click and download the photos.
So unfortunately there is no elegant solution for this (other than using a deduplicating filesystem and hoping for the deduplication to help here).
Skipping the files altogether neither works, because the original files are referenced in the rendered site, they are opened when you click and download the photos.
I know, I was thinking of an option that would also remove the "download" feature. Although I do see how it would be an edge case.
Let's say I can serve the raw images from another HTTP URL - what files should I change in my local theme to make the download button link to that and skip the copy? Or does Hugo just copy the files in content
unconditionally?
I don't know if this is even possible in Hugo. Currently Hugo copies the files unconditionally. Maybe you could add a post-build script which removes the original images, but if they are referenced from the built HTML (like in the Download feature or the href
of the images (which need to be replaced by something like $thumbnails.RelPermalink
then) you might end up with many broken links.
I noticed that a copy of every image is made from
content
topublic
, along with lower-resolution versions. For example:Because photos are duplicated, the project directory takes twice as much space. Would it be possible to hard link the files instead, or add an option to skip the copy entirely?