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

**URL:** <https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540>\
**Category:** support\
**Tags:** pagination\
**Created:** [May 6, 2019, 2:49pm UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540 "2019-05-06T14:49:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 6, 2019, 2:49pm UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/1 "2019-05-06T14:49:24Z")

</div>

Hello!

website: [http://rootkea.gitlab.io/blog/](http://rootkea.gitlab.io/blog/)  
Repo: [https://gitlab.com/rootkea/blog](https://gitlab.com/rootkea/blog)  
config.toml:

```auto
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](http://rootkea.gitlab.io/blog/about)  
But got: [http://rootkea.gitlab.io/blog/blog/about](http://rootkea.gitlab.io/blog/blog/about)

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

What am I missing?

---

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 6, 2019, 3:39pm UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/2 "2019-05-06T15:39:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![funkydan2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/funkydan2/32/5636_2.png) [@funkydan2](https://discourse.gohugo.io/u/funkydan2)\
**Post date:** [May 6, 2019, 11:15pm UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/3 "2019-05-06T23:15:40Z")

</div>

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](https://github.com/rootkea/story/blob/master/layouts/_default/baseof.html#L74) 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.

---

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 7, 2019, 9:05am UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/4 "2019-05-07T09:05:34Z")

</div>

> [@funkydan2](#):
>
> 1. The Story theme uses [.URL](https://github.com/rootkea/story/blob/master/layouts/_default/baseof.html#L74) 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.

Thanks! Somebody has already opened a PR for the same. [use global hugo function,and .URL deprecated by nonumeros · Pull Request #87 · xaprb/story · GitHub](https://github.com/xaprb/story/pull/87)

> [@funkydan2](#):
>
> 1. Try setting `relativeURLS=false` in your config.toml file, _and then_ define urls like `/blog/about/` for your menu??
> 2. 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.

I solved it using my custom subdomain [blog.rootkea.me](http://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.

---

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 7, 2019, 9:14am UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/5 "2019-05-07T09:14:52Z")

</div>

> [@rootkea](#):
>
> I solved it using my custom subdomain [blog.rootkea.me](http://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](https://blog.rootkea.me) but not for [A curious noob](https://rootkea.gitlab.io/blog/) The image on [https://rootkea.gitlab.io/blog/about](https://rootkea.gitlab.io/blog/about) takes the path [https://rootkea.gitlab.io/img/profile.jpg](https://rootkea.gitlab.io/img/profile.jpg) instead of [https://rootkea.gitlab.io/blog/img/profile.jpg](https://rootkea.gitlab.io/blog/img/profile.jpg)

---

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 7, 2019, 9:18am UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/6 "2019-05-07T09:18:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rootkea](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rootkea/32/6998_2.png) [@rootkea](https://discourse.gohugo.io/u/rootkea)\
**Post date:** [May 7, 2019, 9:48am UTC](https://discourse.gohugo.io/t/menu-and-pagination-urls-are-malformed-when-baseurl-is-of-the-form-http-foo-com-bar/18540/7 "2019-05-07T09:48:27Z")

</div>

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](https://foo.bar.com) and [https://foo.gitlab.io/bar/](https://foo.gitlab.io/bar/) without losing `relativeURLs = true`.

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