<?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 How to set conditional displays for modules when in editing/preview modes in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/How-to-set-conditional-displays-for-modules-when-in-editing/m-p/996644#M39640</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;Background&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am developing a nav bar which is transparent with white text on init. This is an issue since the preview for the module has a white background.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Using the &lt;A href="https://developers.hubspot.com/docs/cms/hubl/variables#in-app-editor-and-preview-variables" target="_blank" rel="noopener"&gt;In-app editory and preview variables&lt;/A&gt; allowed me to set a conditional so I can view the menu in it's scrolled from top state. Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;nav class="my-nav {% if is_in_global_content_editor or is_in_module_previewer %}nav-scrolled{% endif %}"&amp;gt;
&amp;lt;!-- All my nav code... --&amp;gt;
&amp;lt;/nav&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the &lt;STRONG&gt;is_in_module_previewer&lt;/STRONG&gt; variable to check if the module was in the preview mode (boolean) and added the class that would make the links visible on white backgrounds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then used the &lt;STRONG&gt;if_is_in_global_content_editor&lt;/STRONG&gt;&amp;nbsp;variable since my nav is a global module and I want my content editors to be able to preview the nav bar while they edit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2024 22:38:27 GMT</pubDate>
    <dc:creator>EdCupaioli</dc:creator>
    <dc:date>2024-06-24T22:38:27Z</dc:date>
    <item>
      <title>How to set conditional displays for modules when in editing/preview modes</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-set-conditional-displays-for-modules-when-in-editing/m-p/996644#M39640</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;Background&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I am developing a nav bar which is transparent with white text on init. This is an issue since the preview for the module has a white background.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Using the &lt;A href="https://developers.hubspot.com/docs/cms/hubl/variables#in-app-editor-and-preview-variables" target="_blank" rel="noopener"&gt;In-app editory and preview variables&lt;/A&gt; allowed me to set a conditional so I can view the menu in it's scrolled from top state. Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;nav class="my-nav {% if is_in_global_content_editor or is_in_module_previewer %}nav-scrolled{% endif %}"&amp;gt;
&amp;lt;!-- All my nav code... --&amp;gt;
&amp;lt;/nav&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the &lt;STRONG&gt;is_in_module_previewer&lt;/STRONG&gt; variable to check if the module was in the preview mode (boolean) and added the class that would make the links visible on white backgrounds.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then used the &lt;STRONG&gt;if_is_in_global_content_editor&lt;/STRONG&gt;&amp;nbsp;variable since my nav is a global module and I want my content editors to be able to preview the nav bar while they edit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 22:38:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-set-conditional-displays-for-modules-when-in-editing/m-p/996644#M39640</guid>
      <dc:creator>EdCupaioli</dc:creator>
      <dc:date>2024-06-24T22:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to set conditional displays for modules when in editing/preview modes</title>
      <link>https://community.hubspot.com/t5/CMS-Development/How-to-set-conditional-displays-for-modules-when-in-editing/m-p/996908#M39646</link>
      <description>&lt;P&gt;Thanks for sharing this&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/391779"&gt;@EdCupaioli&lt;/a&gt;, I've started to see more themes take advantage of the editor/preview variables to improve the user experience - there are a lot of cool things you can do with&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;is_in_theme_editor&lt;/STRONG&gt; as well.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 10:49:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/How-to-set-conditional-displays-for-modules-when-in-editing/m-p/996908#M39646</guid>
      <dc:creator>Jnix284</dc:creator>
      <dc:date>2024-06-25T10:49:50Z</dc:date>
    </item>
  </channel>
</rss>

