Show language switcher when translation is available

We have 4 languages and add a new language with translations over time for all the pages. Is there a way to only show the available languages in the language switcher if the translation for the page actually exists? Right now it goes to 404, but it would be good to hide the option.

Hi @SebScheuer,

wrapping the language switcher code into an if-statement should do the job

{% if content.translated_content.values()|selectattr("published") %}
...
{# language switcher code #}
...
{% endif %}

best,

Anton

Thanks, that sounds like the simplest way to go