Localhost & github pages mismatch

The hugo page in this repository looks just fine on localhost: GitHub - pa20bm/HugoSite

(It’s using the Eureka theme).

Something is going wrong when the hugo command produces the site for github pages, however. The baseURL and title in the config file do not appear as they do on localhost.

I’ve tried deleting the /docs folder and rebuilding the site from scratch, but it doesn’t seem to solve the problem.

Any ideas?

May need to add a backslash to the base URL?

baseURL: https://pa20bm.github.io/HugoSite/

When following the ‘posts’ link in your navigation the url provided is:

https://pa20bm.github.io/HugoSite/HugoSite/posts/

Your baseURL is set to:

https://pa20bm.github.io/HugoSite

So perhaps setting the baseURL to this would work?

https://pa20bm.github.io/
1 Like

I realised looking again at your site that main menu is working correctly and therefore your baseURL is correct.

I have come across this though, and wonder if it might offer a solution:
https://stackoverflow.com/questions/55343573/generated-links-broken-in-hugo-blogdown-when-publishing-to-domain-with-subfolder

It suggests that following the ‘correct’ procedure when defining your menu items results in the duplication of the site folder in urls. They suggest removing the first forward slash as in the example below…

[[menu.main]]
    name = "Projects"
    url = "/projects/"

to

[[menu.main]]
    name = "Projects"
    url = "projects/"
1 Like

This worked. Thanks so much Andy (and Henry).

1 Like

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