Using if statements to only show language switcher url if there is a translated page in HubSpot

Regular Contributor | Diamond Partner

Hi all,


Is it possible to have a statement in my language switcher module so that only if there is a translated page in that language available to display that language option in the switcher, if not don't display that language option in the dropdown?


Here is my code:

<div class="navbar">
  <div class="dropdown">
    <button class="dropbtn">
     <i class="fa fa-globe"></i>
    <div class="language-dropdown-content">
     {% if content.language.langauageTag == "en-us" %} <a href="/{{ content.translated_content['en-us'].slug || '' }}">Americas</a> {% endif %}
     <a href="/{{ content.translated_content['en-gb'].slug || 'en-gb' }}/{{ request.path|split('/', 2)|last }}">EMEA</a>

That if statement isn't working. It's just turning the switcher off on every page.


This is the website:


Many thanks!

2 Replies 2
Community Manager

Hey @DanBQ 


I apologize for the delay in getting back to you. I will tag a few of our experts to give you some tips about this.           


Hey @derekcavaliero @Jsum could you please share your knowledge with @DanBQ          


Thank you,


Did my post help answer your query? Help the Community by marking it as a solution
Esteemed Advisor | Partner

@DanBQ ,


I ran into this problem myself. I searched developer info and all of the docs. As far as I can tell, There is no way to to determine whether a page has translations or not. an ugly solution would be to use the modules html wrapper to check the page name for page's that have translations. something like.

{% if == 'page name 1' or if == 'page name 2' %}
{% endif %}

Let us know if you find a better solution.