How to access Language Code in HTML Header

My website supports two languages.

I couldn’t figure out how to access the language code for the <html> tag:

<html lang="en">

My goal is to have lang="en" on all English sites, and lang="de" on the German ones.

I did try <?php echo $language->code(); ?> without success.

I also found this article in the documentation, but it’s not clear to me: Do I really have to iterate through $languages?

$kirby->language()->code();

will give you the language code for the currently active language.

1 Like