Hello hubspot Community,
im currently looking to integrade a custom language switch to our project. Currently im using following solution and for the most sites this works. But on a few Subpages it does not pick the en href and if im in the en version it uses the english content slug for the german site. Does anyone ran into those problems before. I know there are a lot of posts about this but i coundent figure it out, since this is our first Hubspot project our knowledge is expandable.
Best regards,
Joshua Miller
One example:
this is the href it creates for my language switch:
/en/news/e3-gruppe-in-deutschland-mit-neuem-director-sales-europe-frank-marreau-verstaerkt-regionale-fuehrung-der-live-marketinggruppe
But /en/trends/head was maintained.
{% set eng_url = "/"~content.slug %}
{% set ger_url = "/"~content.slug %}
{% if content.translated_content['en'] %}
{% set eng_url = "/"~content.translated_content['en'].slug %}
{% endif %}
{% if content.translated_content['de'] %}
{% set ger_url = "/"~content.translated_content['de'].slug %}
{% endif %}
<a class="lang-switch language-switch--current" href="{{ ger_url }}" data-language="de">DE</a>
<a class="lang-switch" href="{{ eng_url}}" data-language="en">EN</a>
