How do I get the language of a listing page?

Hi,

I am trying to set the lang html attribute dynamically in my template in a multilingual site.

I can get the language on a page using page.lang but I can’t find how to get it in the listing page, which does not match a section or a page (I am getting Reason: Variablepagenot found in context while rendering 'index.html').

What am I missing ?

Thanks.

You should get a lang variable in most pages

I have the following code in my index.html file.

{% if lang %}
  <pre>{{lang}}</pre>
{% endif %}

The pre is not rendered when I am on my home page (with the pages list). It is available when I am on a content page.

I just updated to 0.7.0 and I have the same result.

I have a minimal WIP test here: https://github.com/SiegfriedEhret/ehretme-next (based on the Ergo theme).

Thanks.

1 Like