chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity
Other
571 stars 263 forks source link

Alternate image formats not being displayed #326

Open LITUATUI opened 2 years ago

LITUATUI commented 2 years ago

The theme no longer shows AVIF images if available with the same name and goes straight to the JPG/PNG fallback.

rootwork commented 2 years ago

@LITUATUI Do you know if it's happening for WebP images too, or just AVIF?

Also images can appear in a variety of ways and contexts, so to narrow this down can you specify:

Also if you could look at the image as it's rendered and tell me if it includes the CSS class image_processed or image_unprocessed that would be helpful too.

LITUATUI commented 2 years ago

Hello.

It happens also with WebP images.

I have all images of my website in one folder and batch converted them to AVIF using ImageMagick. This includes featured images, thumbnails and images inside the body of the posts.

I'm not using page bundles, as all my posts are in one folder.

This happens with local images.

CSS classes:

<picture>

    <img loading="lazy" decoding="async" alt="SVOLT Energy new short blade batteries" class="image_figure image_internal image_unprocessed" src="/images/posts/SVOLT-Energy-new-short-blade-batteries.jpg" data-pos="1"><figcaption class="img_alt">SVOLT Energy new short blade batteries</figcaption>

    </picture>

Showing the AVIF version of images works great if I use an older version of this theme, for example (20220407195657-f40414b5292c). So at least I know that the bug was introduced after Apr 7, 2022.

The Clarity theme is installed as a Hugo module, so I can easily go back to an older version/commit.

rootwork commented 2 years ago

Thanks! This is very helpful. I'll see what I can figure out.

rootwork commented 2 years ago

Can you say a little more about where your content and images are? I assume your posts are in content/posts/? Are the images in question in assets/images/posts/ or static/images/posts/?

LITUATUI commented 2 years ago

Posts: content/posts/ Images: static/images/posts/

If I use an old version of this theme everything works as supposed to.

rootwork commented 2 years ago

Images in static can't have any of Hugo's image processing run on them, because they can't be loaded as a resource.

If it ever did work with images from static, that was an accident -- but now I'm curious how that happened! Do you know what git commit you're on in the version of the theme that this works for you?

LITUATUI commented 2 years ago

This commit made it stop working.

The last working commit for me is: f40414b5292c3af64ee46adc9efb8f034c7465e2