How to manage links in multilingual site

My site is multilingual and home page is set to English language.
On home page I have diffrent tours that user can chose.
Link to it looks like this

<a href='/tours/circle' class="ctaLinkTours">

When my language is default one (English) and when I click on link it takes me to particular tour and it is on English which is fine.

But if on my home page I change language from English to Swedish. Home page URL looks like this


and when I click on link <a href='/tours/circle' class="ctaLinkTours"> it doesn’t stay Swedish it turns back to English.

config.toml looks like this for Swedish language

    languageName = "flagswe"
    LanguageCode = "swe"

    url    = "/swe/"
    name   = "Hem"
    weight = -120

And I was thinking of add to link something like:

<a href='{{ .Params.LanguageCode }}/tours/circle' class="ctaLinkTours">

But is still not working as it should.

Hi there,

Have a look at relLangUrl and absLangUrl.

1 Like

Yes, that is what I needed.
For my case it’s

<a href='{{ "/" | relLangURL }}/tours/circle' class="ctaLinkTours">

You can also try {{ "/tours/circle/" | relLangURL }}

1 Like