Menu and pagination urls are malformed when baseurl is of the form http://foo.com/bar/

Hello!

website: http://rootkea.gitlab.io/blog/
Repo: https://gitlab.com/rootkea/blog
config.toml:

baseurl = "https://rootkea.gitlab.io/blog/"
[[menu.main]]
  name = "About"
  title = "About"
  url = "/about/"

Expected url for about menu item: http://rootkea.gitlab.io/blog/about
But got: http://rootkea.gitlab.io/blog/blog/about

Similarly, the pagination no. links also insert redundant blog in url.

What am I missing?

To be more clear, clicking on the menu item “About” takes user to http://rootkea.gitlab.io/blog/blog/about while expected valid link is http://rootkea.gitlab.io/blog/about

I’m not sure what the answer is, but here’s a few things to try which may point you in the right direction.

  1. The Story theme uses .URL to build the Menu. This is deprecated in the latest versions of Hugo. You might like to raise an issue on the theme and ask the developer to update the theme to work with Hugo > 0.55, or fork it yourself.
  2. Try setting relativeURLS=false in your config.toml file, and then define urls like /blog/about/ for your menu??
  3. I’ve seen some threads here where setting baseURL = "/" and having relativeURLS=false (I think) seems to work where a site is hosted in a subdirectory.

Thanks! Somebody has already opened a PR for the same. https://github.com/xaprb/story/pull/87

I solved it using my custom subdomain blog.rootkea.me for baseurl. Oh and yes, I originally forgot to state that I have relativeURLs = true and I don’t want to change it.

Now, it works for https://blog.rootkea.me but not for https://rootkea.gitlab.io/blog/ The image on https://rootkea.gitlab.io/blog/about takes the path https://rootkea.gitlab.io/img/profile.jpg instead of https://rootkea.gitlab.io/blog/img/profile.jpg

Is it possible to retain relativeURLs = true and make hugo site to serve correctly at https://rootkea.gitlab.io/blog/ as well as on https://blog.rootkea.me ?

Alright, so I finally fixed it using relative path for the image and now I can browse website at both the urls without any issue.

But now, I’m wondering what changes/precautions one needs to take to make hugo website available at https://foo.bar.com and https://foo.gitlab.io/bar/ without losing relativeURLs = true.

Closing this issue and filling a new one for the same.