HUGO

URL keeps stacking on top of itself when navigating around Hugo/Github Pages website

I used the Hugo instructions for a user page here to build and deploy the Hugo website I had locally.

The website exists at a url that looks like https://username.github.io. When I navigate to a blog post, the url starts stacking on itself, ie it becomes https://username.github.io/username.github.io/posts/post_1.

The main issue with this is that if I want to click the blog title link which helps me get back to the homepage, I get a 404 error because the url ends up being https://username.github.io/username.github.io/posts/post_1/username.github.io. Not only is it long and clunky, but it should be https://username.github.io which is the homepage url and is the given <a href> url in the code.

What can I change so the url doesn’t stack on itself?

Can you post your repository so we can have a look into it? It’s either an issue in a template or the baseURL in your config.toml has a weird value.

1 Like

Thanks for the reply. I left my baseURL in the config.toml blank. There could be something weird going on with the template.

As for posting the repo, would it be possible to do so over dm as it needs to be private? I can’t dm anyone myself since I’m a new member, but I can reply to a dm with it.

Try to set it to https://username.github.io/.

You can add @davidsneighbour to the repo (if it’s on Github, if not, ehm, don’t know). But try setting the baseURL first. Remember to add the slash at the end.

I’m sorry in the delay in replying. Thanks for the baseURL change suggestion. The baseURL in the config.toml was already set to username.github.io/ but it needed be to set to https://username.github.io/ exactly for the url to not repeat itself while navigating the website.

Thanks for your help!

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