Site breaking after deployment

Hello everyone, I am new to Hugo and I have been struggling with an issue for a few days, so any help would be appreciated.
I have developed a website locally with Hugo using the Poison theme. As soon as I change the baseURL to "https://<username>.github.io/<repository>" all my different pages stop working (About, Posts, and Projects) and they lead to a 404 error like this

My logo image (called brand image in the theme) loads properly locally even after changing the baseURL value but after the deployment on Github pages, it breaks. The theme guide states that:
NOTE: To display an image in your sidebar, you’ll need to uncomment the brand_image path below and have it point to an image file in your project. The path is relative to the static directory. In my hugo.toml file I have done just that and like I said it works locally but breaks after deployment even though the path is still the same, I am trying to solve this issue too. Thanks in advance!

Public repository

1 Like

Check your baseURL. It points to a subdirectory https://darrylat.github.io/scorpiosec/. Note that if you intend to use a custom domain, it should match your baseURL including the https protocol.

How so? It is pointing to the main directory that is hosting all the Hugo files. I followed the " Hosting and deployment " documentation on the Hugo website. If that is wrong what should the URL be? I do plan on using a custom domain later, but I want the site to be functional before I buy the domain.
I see that the baseURL should follow this style baseURL = "https://<username>.github.io/<repository>" which it does in my case. The link was provided after I used Github actions to deploy the site

Check the URL you typed and your baseURL. They are not the same. E.g https://darrylat.github.io/scorpiosec/about works.

The “posion” theme does not have full support for running the site in a sub directory.

It is mainly in the sidebar the issues arise.

The sidebar menu e.g. does not use Hugos menu system opting instead for a custom solution.

You define the menu items in a “menu” param:

    menu = [
        {Name = "About", URL = "/about/", HasChildren = false},
        {Name = "Posts", URL = "/posts/", Pre = "Recent", HasChildren = true, Limit = 5},
        {Name = "Projects", URL = "/projects/"},
    ]

The theme uses the URL values as is, without running them via any of Hugos URL functions. This way the link do not know anything about the sub directory and then become:

https://darrylat.github.io/about/

instead of:

https://darrylat.github.io/scorpiosec/about/

You can politely ask the theme author if they are interested in working on this issue.

Another “fix” is to update all the URLs on your site to have the sub directory hardcoded. But if you ever move the site to a proper domain you will need to redo that.

1 Like

I didn’t type this URL specifically, after deploying the website I tried to navigate the website as a normal user and notice that all the pages are breaking. I see now that is because it is using the wrong URL but that is the issue I don’t know why it is doing that. Same as to why the logo image is not showing despite following the instructions provided by the theme’s docs.

@frjo

First thank you for your detailed answer, I understand the issue better now.

So if I understand correctly I will need to specify the URLs in the menu param as in
URL = "https://darrylat.github.io/scorpiosec/about/" for the About page for example, and do the same for the Posts page and Project page too?

Do you think the logo image breaking is also caused by the same issue?

Only URL = "/scorpiosec/about/" is needed.

The logo src points to /images/redscorpio.jpg so yes, definitely the same issue since the logo in reality is in /scorpiosec/images/redscorpio.jpg

I think the theme (or I don’t know what else at this point) does not recognize that URL I tried the new one {Name = "About", URL = "/scorpiosec/about/", HasChildren = false}, and it does not work. It just removes the About section

As @frjo described, the “posion” theme

  1. Does not have full support for running the site in a sub directory
  2. Does not use Hugo’s menu system

Please raise an issue with the theme author:
https://github.com/lukeorth/poison/issues

1 Like

okay thanks, will do

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