CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.89k stars 1.6k forks source link

cover image: the original image duplicates with its md5-named copy #927

Open Elypha opened 8 months ago

Elypha commented 8 months ago

What happened?

desc

I'm testing this on the starter project with no modifications for reproducibility

2024-01-13_02-33-40_396

I'm not sure if this is intended, but it seems that we get 2 images with the same 'content' under /public

reproduce

you only need the related recommendation feature in hugo config being enabled, which is by default, and hugo

codes

it seems that the following codes are related

https://github.com/CaiJimmy/hugo-theme-stack/blob/master/layouts/partials/article/components/related-content.html#L8 calls article-list/tile and the md5 duplication is created at https://github.com/CaiJimmy/hugo-theme-stack/blob/master/layouts/partials/article-list/tile.html#L8 when $imageRaw is referred to at line 9.

idea

my personal idea is to keep only the md5-named image in the build, and exclude the original unrenamed image. however, I notice that the original image name is used in some meta tag for opengraph, so this may require some more effort.

but the problem is purely about storage worries. any other method would also work so long as it prevents duplication

Hugo version

hugo v0.121.1-00b46fed8e47f7bb0a85d7cfc2d9f1356379b740+extended windows/amd64 BuildDate=2023-12-08T08:47:45Z VendorInfo=gohugoio

Theme version

current latest master: https://github.com/CaiJimmy/hugo-theme-stack/commit/21da06e448fe466ef0a03d1c717847f0eb0049fe

What browsers are you seeing the problem on?

Chrome

More information about the browser

No response

Relevant log output

No response

Link to Minimal Reproducible Example

https://github.com/Elypha/hugo-theme-stack-starter