chipzoller / hugo-clarity

A theme for Hugo based on VMware Clarity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alternate image formats not being displayed

LITUATUI opened this issue · comments

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

@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:

  • Is this an image specified with frontmatter (featured image, thumbnail) or in the body of a post?
  • Are you using Hugo page bundles?
  • Is this a local image (on your system) or a remote image (a URL)?

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.

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.

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

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/?

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

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

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?

This commit made it stop working.

The last working commit for me is: f40414b