Post cover image not showing up - PaperMod

Hi everyone, and first thanks for all the extremely valuable information I’ve found here so far :slight_smile:

I made my website (https://clement-martin.fr) using Hugo and Papermod (which I modified here and there) and I’m fairly satisfied with the result, but I have one problem: when I share my posts on social media (Bluesky, discord etc.), the cover image I’ve defined for those doesn’t show up.

It does appear if I link to the homepage (see below), but it doesn’t for other pages.

I don’t think any solution is mentioned on the PaperMod repo, so I come asking for more general solutions. Has anyone else already had this issue? Is there a workaround?

Thanks in advance!

Clem

You are more likely to receive a prompt and accurate response if you post a link to your project’s Git repository.

See Requesting Help.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

You can check the pages for the necessary meta tags. In this case the image is not found: https://www.heymeta.com/results?url=https://clement-martin.fr/en/posts/grand-reopening/

2 Likes

Well, the HTML tries to load https://clement-martin.fr/images/ignition.jpg and can’t find it. Ensure that the img’s src attribute is correct – if you don’t share your repository, that’s all one can suggest.

2 Likes

I’m sorry I haven’t posted my repository, but I’m not using one! I’m self-hosting on a private server.

That being said, I didn’t know about heymeta.com, and it’s quite helpful: it shows that opengraph (or whatever else is picking up the image from my post) looks for it in /static. It must have to do with the fact that my site is multilingual and organized in folders. I assume I’ll have to modify layout/partials/opengraph.html or layout/partials/_funcs/get-page-images.html (as seen in PaperMod’s repo GitHub - adityatelange/hugo-PaperMod: A fast, clean, responsive Hugo theme.)

Thanks for your help!

Nevermind, I’ve found the solution (also thanks to @JemmsUK and @chrillek): it’s in this PR on the mod’s page, for anyone in the same boat as me. Handle cover image URL in partials when image is a resource by LordGaav · Pull Request #1283 · adityatelange/hugo-PaperMod · GitHub

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.