I have been using zola and for th most part it works fine, but while linking to different pages it breaks.
I have set the base url as:
# The URL the site will be built for
base_url = "https://www.xypnox.com/blag"
And it gets deployed to githhub pages.
The problem arises when I link from a post say at /posts/migrating-to-zola/ to /about/ page. When I use [About](/about) this works fine in local server but breaks on deployment and if I use [About](/blag/about) this breaks in local server but works fine when deployed.
Is there a way to link these properly that the links work in both local server and when deployed?
I have tried [About](../../about) but it looks ugly and isn’t as clear, it requires knowing the current path and can’t be reused in different level directories.
As you suggested, the shortcode will solve my problem but it is one more complication and I wonder if there could be a better way to achieve this. For example if there was a setting in zola that inserted the base URL at the end of each link that began with a root / this problem wouldn’t occur and simple /about would work in both local server and when deployed.
isn’t this problem solved by using Zola internal links?
If you have base_url configured in config.toml to include the subdirectory in which your site is deployed then all internal links are created relative to that.
if you have:
base_url = "http://example.com/temp"
and use the following link in markdown:
test a link [link](@/somepage.md)
The following will be created:
<p>test a link <a href="http://example.com/temp/somepage/">link</a></p>
it does always include the full URL including the domain, which is not necessary but it works.
Thanks @Marco,
I didn’t realize that the .md extension was necessary for the deep linking to work, I thought it would work without it.
I tried the Internal link and it works like a charm! Thanks!