Issue with images in a multilingual multihost configuration

After updating to v0.123, I’m seeing an issue with my featured images that I’m pretty sure it has to do with this issue. In my blog posts, the thing is that some featured images are shown, while others don’t. But all of them are equivalent, in the sense that the featured image is in my main language (Spanish) only.

Interestingly, manually copying the featured image in my English post folder doesn’t work either (it worked with v.0.122 without even having to copy the image).

Any idea why this behavior?

Repo: GitHub - rodrigoalcarazdelaosa/fisiquimicamente: FisiQuímicamente / PhysiChemically / FisiQuímicament

Function that gets the featured images: hugo-blox-builder/modules/blox-core/layouts/partials/blox-core/functions/get_featured_image.html at main · HugoBlox/hugo-blox-builder · GitHub

Example post that correctly shows the featured image: live here, source here

Example post that doesn’t get the featured image: live here, source here

Can you provide a small site where we can reproduce the behavior? 1.7 GB is a bit large.

Sure, I’ll try to reproduce it with the same template I’m using, although as I said I’m only seeing the behavior in a few posts, making it hard to find a possible explanation.

In any case my site takes a while (some minutes) to build the first time but once a resources folder is generated it rebuilds in seconds.

It must be related to the function for getting featured image, as on direct link to featured.jpg file in english post: https://physichemically.com/blog/2023/07/31/women-in-science/featured.jpg the picture is there for english post even that the file originally in in Spanish post folder. Interesting.

Whats the specific function in your site to convert it to WebP?

Found it.

I am thinking that your module, hugo box builder, may not be yet compatible with 0.113 and the changes that were introduced.

The featured image is getting lost somewhere when is converted to WebP.

It’s actually this one (note that $featured is the return value of the get_featured_image function).

You sure you mean v0.113? That release is related to TLS/HTTPS support in hugo server.

Mistyped, 0.123

When you run your site locally hugo serve could you check if in public folder or resources/_gen/images you got the following files:

  1. featured_hue562484f8002efd2597fb6bc303b2efb_126912_0x0_q75_h2_.webp
  2. featured_hue9b5410fac3a3272a66906b2e1e5d5e4_173044_0x0_q75_h2__2.webp

1st file is the one that is missing, 2nd is the one that is displayed.

Are both files working when running site locally?
If your hugo is generating these files when hosting locally, maybe there is an issue when is generated in production?

I’m not at computer now but I can’t see the images locally either, so that file probably won’t be there. Just in case, the site built fine with v0.122.

@idarek I’ve got these files in that particular blog post folder:

Where you hosting your website?
Maybe there is files limit. For example Cloudflare Pages got a limit of 20,000 files.

I’m using Cloudflare Pages but as I said I can’t see the images locally either. This is for example the log of my latest upload, which seems fine.

I also got this:

You got this file in resources/_gen/images however you are not pushing this folder to GitHub hence when Cloudflare is generating page, it generating this files for you.

On my private website I am pushing it with my GitHub as this saving me lot of time on re-generating this files on Netlify, but still, cloudflare is doing this with keeping previous caches (which looks like is much faster than netlify). I think maybe a cache for this file is corrupted on cloudflare end.

If I can suggest, if you can temporarily replace file featured.jpg in post women-in-science with something different and publish site and see if different image will appear correctly. If it will, this looks like caching issue.

Than we can look further.

But how does that explain that I can’t see those images locally either? I’ve cleared my browser’s cache and even opened my website with a fresh browser and I still don’t see them (while I could see them when building with v0.122).

Missed that. Will look further.

1 Like

When testing an octopus, the first thing I do is remove all of its legs.

content

content/
├── de/
│   ├── s1/
│   │   └── p1/
│   │       ├── featured.jpg
│   │       └── index.md
│   └── _index.md
└── en/
    ├── s1/
    │   └── p1/
    │       └── index.md
    └── _index.md

config

defaultContentLanguage = 'de'

[languages.de]
baseURL = 'https://de.example.org/'
contentDir = 'content/de'
weight = 1

[languages.en]
baseURL = 'https://en.example.org/'
contentDir = 'content/en'
weight = 2

test

git clone --single-branch -b hugo-forum-topic-48501 https://github.com/jmooring/hugo-testing hugo-forum-topic-48501
cd hugo-forum-topic-48501
rm -rf resources public && hugo && tree public

result

public/
├── de/
│   ├── s1/
│   │   ├── p1/
│   │   │   ├── featured.jpg
│   │   │   ├── featured_hu2da4d17f85aacea80976f9621a89ee6c_41138_200x0_resize_q75_h2_box.webp
│   │   │   └── index.html
│   │   └── index.html
│   └── index.html
└── en/
    ├── s1/
    │   ├── p1/
    │   │   ├── featured.jpg
    │   │   └── index.html
    │   └── index.html
    └── index.html

And there’s the problem. On a multilingual, multihost site the original image from the default content language is copied to the other sites, but the processed resources are not.

Need to log a bug.

Please leave this in an unsolved state until the bug has been logged.

2 Likes

Wonderful as always, @jmooring. New name on the horizon: Wowchemy → Hugo Blox → Octopus

https://github.com/gohugoio/hugo/issues/12163

1 Like

This was fixed with https://github.com/gohugoio/hugo/pull/12167, available in the next release.

1 Like