Landing page which shows all languages available on site

Hey all,

I’m wondering if it is possible to have a top-level homepage that would list all the translations available? The user would then be able to choose which language they would like and click through to the regular homepage for that language.

Thanks,
Dan

That’s actually just a language switch as it’s described in the docs: https://getkirby.com/docs/guide/languages/switching-languages#switch-a

Simply insert this code in the home template and you get a top-level homepage listing all the languages.

I believe the home template also gets translated though correct?

Not if there’s nothing to translate :slight_smile:

If you want to display text on the home page and always have it in e.g. English you can simply use that language as a fallback languages and not create any translations.

The alternative would be an overlay, because you probably don’t want to show the language selector each time the visitor visits the page, but store this selection in a cookie?

If you have language specific domains, you could also have a landing page on the main domain:

Thanks a lot for your fantastic suggestions! Will definitely be using the homepage and domain advice :slight_smile: How would I be able to set a cookie to remember the chosen translation?

Kirby has a class for cookie handling: https://getkirby.com/docs/reference/tools/cookie

Thanks, would you be able to post an example?

Or would there be somewhere where I could see an example of this? I have looked through the docs, cookbook, and forums, but can’t seem to find many examples of this.

Basically, you need the Cookie::set() method to set the cookie, and the Cookie::get() method to retrieve the cookie, that all there is to it apart from the options (expiry etc.).

Setting a cookie with the key mycookie and value hello with a lifetime of 60 minutes:

Cookie::set('mycookie', 'hello', ['lifetime' => 60]);

Retrieving the cookie value:

Cookie::get('mycookie');