Leaving base_url empty

Hi! I might be missing something but why doesn’t Zola let me assign base_url to a value of an empty string. There’s no need for the relative or absolute links to contain the domain name, the browser adds them automatically. If I click <a href="/archive">Archive</a> link on website myblog.com the browser automatically sends me to myblog.com/archive.

Currently Zola hardcodes all links with the full domain (mywebsiteurl.com/path instead of /path). This makes testing a lot harder, and you can’t access the website with IP address (important mostly when testing, or when the domain stops working etc). I can’t see a single good reason for this. base_url = “/” doesn’t work either because then links start with “//myurl”

Should I create a Github issue or is there something I’m missing? Thanks!

1 Like

There’s no way to have an empty base_url no, that’s intentional.

What do you mean it’s harder? You need to use zola serve for local testing

I just can’t see the reason for hardcoding the domain name to website links. I’d like to serve my site on my web server and keep a mirror on Github Pages. And I’d like to test the deployment on my web server before getting a domain name. Now every situation needs a custom build script or Github pipeline when zero would be enough. I can’t see any upsides to hardcoding URL:s like that.

Is there a reason for disabling empty base_url that I’m missing?

Sitemap and feeds do require an absolute URL.

1 Like