Scheme relative BaseURL

Am I correct that only has only one scheme setting possible (either https or http)?

i.e. if my baseurl is defined in my config file as:
baseurl = "https://mysite.tld"

It will only load/set everything to https://? Is there a way to make this scheme relative (i.e. //mysite.tld)? especially since most themes link the css like so:

{{ .Site.BaseUrl }}/css/poole.css

Might not be the answer you’re after, but: Have you tried it?

Hello,

I’ve just realized that hugo server automatically adds localhost to the BaseURL, and so I thought it didn’t work as it would render my assets as http://localhost:1313//extensions (just adding two slashes)

However, I just tried out building it (without the server) and it does indeed just make it scheme relative!

Thanks for pointing me in the right direction!

Hello bep. While using ‘//mysite.tld’ works for production, it does not work for development as localhost is still added. Hence hugo says:

Web Server is available at http://127.0.0.1:1313//mysite.tld/myrellink/

and accessing that link results in a 404. Ideally hugo should remove mysite.tld as it is the domain name itself.

Adding https:// fixes the problem, but then I have to edit it out for production. Just something to consider? I’m still on the edge if I should post it on github as an issue.

This smells like a GitHub issue.

1 Like

I’m seeing this issue too. Using //mydomain.com as the baseURL in my config works when deployed, but it breaks the local server stuff. Was there an issue filed? Can’t find it.