Base URL (Again!)

Hi, I have a multilingual site (af | en).

There will always be a locahost development site and a production site.

The problem is with multilanguage URL rewriting eg. http://mysite/en and http://mysite/af (which is good and is what I want) where stable links in markdown text becomes mangled eg. http://mysite/en that becomes http://mysite/en/af

An explanation of what happens:

A link on an Afrikaans page in Markdown will be [mylink](/af/mypage) but this becomes http://mysite/af/af/mypage

Now if something like this existed, it would solve my problems: [mylink](%base_url%/af/mypage)

Yes, I can enter the full URL in markdown [linktext](http://mysite/af/mypage) but then my localhost site becomes painful to use and debug.

Yes, I searched and I spent a long time searching for something like a %base_url% variable, but without success.

Thanks in advance, any pointers in the right direction will be appreciated.

Just an update, the LangSwitcher plugin solved my requirement for a stable link to switch languages that works on both a localhost site as well as the hosted site.

However, in the case of multilingual sites, on-page links such as this gets mangled, [mylink-text-in-afrikaans](/af/mylink) which becomes http://localsite/en/af/mylink when choosing the alternate translated page. To get stable on-page links, a full url has to be specified [mylink-text-in-afrikaans](http://mysite/af/mylink) which affects the development on a localhost site where links won’t work.

I presume I should open a bug/feature request (or possibly develop a plugin?) for something like a %base_url% type variable that will point the the actual base URL in use, that can be used like this: [mylink-text-in-afrikaans](%base_url%/af/mylink)

Hello!

Does not one of these variables solve your problem?
https://learn.getgrav.org/themes/theme-vars