I have developed with Zola a website that works well on my local computer, however I do have a problem for Deploying it on the server of my website.
The problem is that the address of my website will be of this form : http://some/adress.com/mywebsite
and that all the addresses I am allowed to access are of the form http://some/adress.com/mywebsite/example
and not http://some/adress.com/example
So I can fix it by modifying manually all the links in my markdown pages like this : [a link](/Some/link.pdf) becomes [a link](/mywebsite/Some/link.pdf)
The problem with doing so, is that I will no longer be able to test my website in local because it won’t work in local afterward.
Is there any solution to get a zola project able to serve both in local and on the server in my case ?
Yes it’s include.
I finally changed all the links, so the website is working now perfectly on the server, but when I locally serve it with zola serve, I need to remove manually in the url all the /mywebsite to navigate for most of the links (except the ones between markdown pages with your notation @/some/link.md for which I didn’t need to modify).
I (naively) tried zola serve --base-url 127.0.0.1/mywebsite/ and zola serve --interface 127.0.0.1/mywebsite/ to make it still work in local, but without success.
By the way I didn’t get the difference between interface and base-url (I am a very newcomer to web programming)
In my case, the problem is accessing content from the webroot when the base_url is a subfolder.
A markdown absolute link produces (as expected) an HTML absolute link, as expected. A relative link will produce a relative link.
I guess what i would like to do is something like [link](@/foo) where foo could be in static, or could be some file inserted outside of zola in my build pipeline. Have i missed something or is it not possible yet?
interface is the network interfaced on which you receive connections (wifi/ethernet/localhost), you should not have to change that in most cases. --base-url was indeed the option you were looking for.
Thanks for the help, however, when I am doing as you say zola serve --base-url "http://127.0.0.1/mywebsite"it still says that the web server is available at http://127.0.0.1:1024, and the only thing that changes is that I have no more css style display when navigating through the website…
Yeah it seems serve command was not built to be used with subfolders, although the output you just mentioned is an output bug, URLs should be generated properly (but placed in public/ not public/website/ so it won’t work to simulate your use).
As a trick to test the subfolder locally, you can build your site with the correct URL with zola build, then create a symbolic link from mywebsite to public/, and serve the whole website folder (who will therefore have a /mywebsite/) subfolder: