<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Wrapping HTML in a menu module to change blog language version? in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/763896#M33118</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/403242"&gt;@IPars&lt;/a&gt;&amp;nbsp;- I'd recommend moving the language switcher outside of the menu module and using HubSpot's built-in multi-language functionality instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your header you can use &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/default-modules#language-switcher" target="_blank" rel="noopener"&gt;the langugage switcher module&lt;/A&gt;, then you can follow the &lt;A href="https://knowledge.hubspot.com/blog/create-a-multi-language-blog" target="_blank" rel="noopener"&gt;advice on the help center on creating multi-language blogs&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your language switcher module will look something like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% module "language-switcher" 
  path="@hubspot/language_switcher",
  label="Language Switcher",
  display_mode="localized"
%}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And without any styling will look something like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Language Switcher" style="width: 126px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86614iEE1028455137D7DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="lang-switcher.jpg" alt="Language Switcher" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Language Switcher&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which doesn't look like yours, but you can use CSS to remove the globe, remove absolute positioning from the dropdown... etc. to style it. The HTML looks like this so it's straightforward enough:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Language Switcher HTML" style="width: 842px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86615i77AC6831FC541817/image-size/large?v=v2&amp;amp;px=999" role="button" title="lang-switcher-code.jpg" alt="Language Switcher HTML" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Language Switcher HTML&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to hide the current language as well by using a condition and comparing it to the page's current language (using the &lt;CODE&gt;{{ content.language }}&lt;/CODE&gt; tag - see page variables &lt;A title="Website pages variables" href="https://developers.hubspot.com/docs/cms/hubl/variables#website-pages-variables" target="_blank" rel="noopener"&gt;here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I've always used JavaScript to output "EN" instead of English by pulling the data-language tag, like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/* Change links in the switcher from language (e.g. English) to abbreviation (e.g. EN) */
var langLinks = document.querySelectorAll(".lang_switcher_link");

langLinks.forEach(function (langLink) {
  var language = langLink.dataset.language.toUpperCase();
  langLink.text = language;
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But am curious if anyone else has a more HubL friendly way of doing it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Stephanie O'Gay Garcia&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A style="cursor: pointer; text-decoration: none; color: #000000;" href="http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity" target="_blank"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity" target="_blank"&gt;Website&lt;/A&gt; | &lt;A href="http://www.stephanieogaygarcia.com/contact?utm_source=HubSpotCommunity" target="_blank"&gt;Contact&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2023 14:39:15 GMT</pubDate>
    <dc:creator>Stephanie-OG</dc:creator>
    <dc:date>2023-03-03T14:39:15Z</dc:date>
    <item>
      <title>Wrapping HTML in a menu module to change blog language version?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/763568#M33098</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm a HubSpot and HubL novice trying to develop a blog template with navigation styled similar to my corporate website (WordPress), which includes an English/French language switching link:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IPars_0-1677793271616.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86543i9812327F9E381CD1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IPars_0-1677793271616.png" alt="IPars_0-1677793271616.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m currently using a menu module to create the navigation. I'm trying to figure out if it's possible to use wrapping html and HubL code to apply some logic to the menu module when the EN (English) or FR (French) link is clicked, i.e., if on an English page and clicking the FR link, go to the French version (if there is one; otherwise, go to the French blog listing page), and&amp;nbsp;if on a French page and clicking the EN link, go to the English version (if there is one; otherwise, go to the English blog listing page).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For reference this is the menu html&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IPars_1-1677793627098.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86547i31C23119AEE86B24/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IPars_1-1677793627098.png" alt="IPars_1-1677793627098.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 21:54:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/763568#M33098</guid>
      <dc:creator>IPars</dc:creator>
      <dc:date>2023-03-02T21:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapping HTML in a menu module to change blog language version?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/763896#M33118</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/403242"&gt;@IPars&lt;/a&gt;&amp;nbsp;- I'd recommend moving the language switcher outside of the menu module and using HubSpot's built-in multi-language functionality instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your header you can use &lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/default-modules#language-switcher" target="_blank" rel="noopener"&gt;the langugage switcher module&lt;/A&gt;, then you can follow the &lt;A href="https://knowledge.hubspot.com/blog/create-a-multi-language-blog" target="_blank" rel="noopener"&gt;advice on the help center on creating multi-language blogs&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your language switcher module will look something like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% module "language-switcher" 
  path="@hubspot/language_switcher",
  label="Language Switcher",
  display_mode="localized"
%}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And without any styling will look something like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Language Switcher" style="width: 126px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86614iEE1028455137D7DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="lang-switcher.jpg" alt="Language Switcher" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Language Switcher&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which doesn't look like yours, but you can use CSS to remove the globe, remove absolute positioning from the dropdown... etc. to style it. The HTML looks like this so it's straightforward enough:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Language Switcher HTML" style="width: 842px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/86615i77AC6831FC541817/image-size/large?v=v2&amp;amp;px=999" role="button" title="lang-switcher-code.jpg" alt="Language Switcher HTML" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Language Switcher HTML&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to hide the current language as well by using a condition and comparing it to the page's current language (using the &lt;CODE&gt;{{ content.language }}&lt;/CODE&gt; tag - see page variables &lt;A title="Website pages variables" href="https://developers.hubspot.com/docs/cms/hubl/variables#website-pages-variables" target="_blank" rel="noopener"&gt;here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I've always used JavaScript to output "EN" instead of English by pulling the data-language tag, like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;/* Change links in the switcher from language (e.g. English) to abbreviation (e.g. EN) */
var langLinks = document.querySelectorAll(".lang_switcher_link");

langLinks.forEach(function (langLink) {
  var language = langLink.dataset.language.toUpperCase();
  langLink.text = language;
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But am curious if anyone else has a more HubL friendly way of doing it!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Stephanie O'Gay Garcia&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;A style="cursor: pointer; text-decoration: none; color: #000000;" href="http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity" target="_blank"&gt;Freelance HubSpot CMS Developer&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.stephanieogaygarcia.com?utm_source=HubSpotCommunity" target="_blank"&gt;Website&lt;/A&gt; | &lt;A href="http://www.stephanieogaygarcia.com/contact?utm_source=HubSpotCommunity" target="_blank"&gt;Contact&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 14:39:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/763896#M33118</guid>
      <dc:creator>Stephanie-OG</dc:creator>
      <dc:date>2023-03-03T14:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Wrapping HTML in a menu module to change blog language version?</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/764052#M33127</link>
      <description>&lt;P&gt;Thank you so much for this Stephanie! I'm going to take a closer look at it next week... I think it might be just what we need. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 20:41:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Wrapping-HTML-in-a-menu-module-to-change-blog-language-version/m-p/764052#M33127</guid>
      <dc:creator>IPars</dc:creator>
      <dc:date>2023-03-03T20:41:18Z</dc:date>
    </item>
  </channel>
</rss>

