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!
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?
For me this is a very important issue and maybe a deal breaker for using zola.
Some very concrete usecases:
Publishing on IPFS where a user may use any arbitrary URL that happens to have an IPFS node running.
Serve my site on my web server and keep a mirror on Github Pages
Access my site via IP address when DNS hasn’t updated or is otherwise slow, broken, or inconvenient
Host my site at my main URL, but also at my legacy URL that some people might still have bookmarked
The counterpoint that “Sitemap and feeds do require an absolute URL” also has validity, but this is no reason to still hardcode the base URL in stylesheet links and etc. Some sites don’t even use feeds, and while sitemaps are nice, I would argue they are secondary to the site itself and could perhaps be optional if no canonical base_url is provided.
I recently ran into this issue as well. I agree with JoshyOrndorff.eth above (except for holding Urethreum, which is a scam) . My reason is the below use case that Zola does NOT seem to support:
1. Masked DNS Redirect (Cloaked/Framed Redirect)
What it does: The browser displays the original domain in the address bar, but the content is loaded from the destination URL. This is achieved using an HTML frame or iframe.
How it works: When a user visits your domain, the server loads the content from the target URL (e.g., a target site on back-end) without changing the visible URL in the browser.
Use cases:
You want to maintain your domain’s branding in the address bar (e.g., users see your domain even though content is served from another site).
You’re redirecting to a third-party site (e.g., a booking or e-commerce platform) but want to keep your domain visible.
Pros:
Preserves your domain name in the address bar for branding.
Useful for temporary or white-labeled redirects.
Cons:
Can break some functionality (e.g., deep links or bookmarks within the target site).
Not SEO-friendly; search engines may not index the target site’s content under your domain.
May cause issues with modern web features (e.g., JavaScript, responsive design).
When to use: Choose Masked when branding is critical, and you don’t mind potential functionality or SEO trade-offs (e.g., redirecting to a third-party service like a shop or form).