Static site images not showing due to index.html having backslashes

Hello there,

I’m trying to publish my hugo site but non of the images show when I check the static file from public folder. I traced the sources in the index.html and I notice that hugo adds ’ / ’ before the source URL which is a wrong path.

For example:

The following code should start without slash as “images/logo.png”. But hugo made it like this:

class=“” src=“/images/logo.png” alt=“images/logo.png”

Any solution?

Where is the “backslash” you mention in the title? Also, you’re more likely to receive speedy and accurate help if you show your code, e.g. by posting a link to your repository.

By default, Hugo generates files that must be served by a web server. Opening a published file directly from the file system doesn’t do what you think it does.

If you want to preview your site, run hugo server.

I have just checked it on S3 static site and it worked perfectly. Thanks

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