I’m new here and just started to develop my first project with kirby. The website ist bilingual, in German and French. In the footer I have links to two invisible pages, the legal stuff (Impressum and Datenschutz in German). For the footer I’ve created a snippet, and to display the links in the correct language I use this construct, which check for the active language and then spits out the German or French version of these two links:
Yes there is… you should really use a language switcher, and language strings for things you can’t translate via the blueprints - this is useful for things like form error messages. Kirby will take care of the correct page links then, without the need for all that. Echoing html isn’t really best practice
What do you mean, for your main navigation? What type of language switch do you use? It shouldn’t matter if the page is invisible or not, but I don’t know your code.
Thanks texnixe, your code snippet works and is more elegant than mine, exactly what I was looking for!
Don’t mind about the main navigation, that one works fine and already gives me the links in the correct language, without complicated code, using the method described in the docs. It was meant as an answer to Jim.
I was a bit stuck with referencing invisible pages, and didn’t came accross $imprint in the docs.
$imprint is just a made-up variable name, you can name it anything you like. I just like variable names that tell me what’s in them.
Apart from that , as far as fetching visible and invisible pages is concerned, there is no difference between these pages. It’s just a flag that helps to filter pages.
If you have more pages that you want to fetch, it might make sense to store them in an array and then loop through that: