HUGO

relLangURL prepends unnecessary slash on build but not on server

I’m using relLangURL with an absolute URL: {{ “https://minnojs.github.io/blog” | relLangURL }}
When compiling with the server (hugo server -t docsy), this is compiled correctly as
But when building the site (hugo -t docsy) it prepends a leading slash rendering it incorrect.

I’m running Pop!_OS 20.10

This is the output of hugo version:
Hugo Static Site Generator v0.74.3/extended linux/amd64 BuildDate: 2020-07-29T18:11:24Z

Does anyone know what’s going on?

Check your baseURL value in config.toml. I would not use an absolute URL in your layouts. just use the /blog-part and let Hugo deal with the current domain. On hugo server it’s always some form of localhost and on the production server the baseURL is used.

Hi, thank you so much for your response.
baseUrl was set to “”.
Thanks to your response I figured out it should be set to “/” instead.

(Also, I don’t use the explicit string in my layout, it is taken out of a page parameter :slight_smile: )

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