Issue when baseurl have subdirectory

Hi all,

My baseurl is something like: . It seems when the baseurl have subdirectory, then the internal links are not rendered correctly. When the site is created using hugo command then the /~pdas part is omitted by all the internal URLs. As a result the internal links along with the images are not rendered correctly.

Is this a bug related to Hugo or it have something to do with the theme? I am using academic.

For example please see this post: Here the image URL are missing the ~pdas part of the URL. As a result the post is not showing the images correctly. My version is: Hugo Static Site Generator v0.16 BuildDate: 2016-06-06T05:33:33-07:00.

Can you give us the command that you use to build your site, please?

I tried both hugo and hugo --theme=academic. The output is same.

It turned out to be a Hugo bug for no rooted websites… Will wait for it to be resolved in next version.

In the meantime I have solved the issue by setting both relativeURLS and canonifyurls to true.

1 Like

This is very similar to what I experience. I’m testing some hugo sites using a deploy script which substitutes the baseurl in the config.toml to have it sit under something like and in production it runs (e.g.) under

I’m using the HugoMDL theme and what breaks is at least the cardthumbimage and cardheaderimage, which are by default under /images/cardthumbimage.png or something similar.
If this would be rendered as baseurl+/images/cardthumbimage.png it would turn out ok, but as it is, it’s always /images/cardthumbimage.png

Is this the same bug?

As far as I understand you need a truely portable Website.
To test this you may start it from the local file system/public folder without the use of hugo server. If successful it should work anywhere, also in your server subdirectory.

To get this see this discussion:
But be prepared to do changes in the theme as explained there.

@Protik_Das any news about the fix? (you wrote that the issue will be in a next version).

I’m using 0.32.2 version of hugo (with ananke theme) and the problem still exists. The option canonifyURLs solves the problem, but as it is not a default (and suggested) setting, I’m wondering if something related to this issue is still happaning.

1 Like

Use the following config to solve this problem.