Images not showing on Github Pages

Hi,
As you can see in the website Julien Rineau the images are not displayed. I already check several topic regarding this issue but none of the solution proposed fixed my issue (removing “/” in front of image path, changing baseUrl, using different workflow etc…)

Here is the repo GitHub - JulienRineau/blog

Has sb an idea of what is happening ?

You are serving the web site from the “blog” subdirectory.

Your image links point to /img/wav2vec2/architechture_paper.png but the image in question have in reality this path /blog/img/wav2vec2/architechture_paper.png.

You can manually fix all the image paths or use a render hook to always build correct URLs.

P.S. You should set baseURL to https://julienrineau.github.io/blog. The site still works since the workflow action saves you by setting the baseURL correctly when it runs the hugo command. Still best to have correct values. Misconfigured baseURL makes up a large part of the support requests on this forum.

3 Likes

And welcome to Hugo!

1 Like

Doing this will make things much easier to maintain long term.

mkdir -p layouts/_default/_markup
touch layouts/_default/_markup/render-image.html
touch layouts/_default/_markup/render-link.html

Then:

  1. Copy this into render-image.html

  2. Copy this into render-link.html

  3. Add this to your site configuration:

    module:
      mounts:
      - source: assets
        target: assets
      - source: static
        target: assets
    

With many themes you could just enable the default render hooks in your site configuration, but the PaperMod theme provides its own (which doesn’t do much) so we have to override it.

1 Like

Awesome, it indeed solved my issue. Thanks for the quick fix!

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