<?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: DisabledException: 'module' is disabled in this context in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752660#M32727</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/402903"&gt;@JanRa&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this reading time script&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set initialPostWords = content.post_body|striptags|wordcount %}
         {% set calculatedPostWords = (initialPostWords/100) * 100 %}
         {% set finishedPostWords = calculatedPostWords|divide(300)|round(2) %}


{{ finishedPostWords|round }}&lt;/LI-CODE&gt;
&lt;P&gt;using it for years and never had issues with it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 10:28:11 GMT</pubDate>
    <dc:creator>Anton</dc:creator>
    <dc:date>2023-02-07T10:28:11Z</dc:date>
    <item>
      <title>DisabledException: 'module' is disabled in this context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752622#M32726</link>
      <description>&lt;P&gt;Hi Devs,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;The Problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I recently run into an issue saving custom modules in my hubspot blog-index dnd template.&lt;BR /&gt;The error notice told me:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Error while updating a module&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Please click "Apply changes", try again, or check if the "blog-listings" module has errors. &lt;/EM&gt;(translated)&lt;BR /&gt;&lt;BR /&gt;After further investigation the chrome dev-tools notified me about the problem, mentioned in this subject:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;DisabledException : 'module' is disabled in this context&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;STRONG&gt;Further investigation:&lt;BR /&gt;&lt;/STRONG&gt;I checked all my templates for nested modules and destructed my whole theme in another developer account.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Removing and reinserting modules showed me, that my post-listing modules caused this issue. More precisely, my readingtime estimation macro seems to cause the error.&lt;BR /&gt;&lt;BR /&gt;With the message &lt;EM&gt;'module' is disabled in this context &lt;/EM&gt;in mind, maybe some blog-posts contain modules or further logic in their content. It wasn't an option to edit all my blog-post contents.&lt;BR /&gt;Debugging their &lt;EM&gt;post_body&lt;/EM&gt; didn't show any modules neither.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;My thoughts to fix it&lt;/STRONG&gt;&lt;BR /&gt;I guess my readingtime macro causes hubspot to parse the post_body of my posts in my custom module context&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;!-- old and problem causing example --&amp;gt;
{% macro readingtime(mytext) %}
	{% set time = mytext|striptags|wordcount|divide(225)|round(0, "ceil") %}
	{{ time &amp;gt; 0 ? time : 1 }}
{% endmacro %}

&amp;lt;!-- fixed version of readingtime estimation escaping curly braces --&amp;gt;
{% macro readingtime(mytext) %}
	{% set time = mytext|escape_jinjava|striptags|wordcount|divide(225)|round(0, "ceil") %}
	{{ time &amp;gt; 0 ? time : 1 }}
{% endmacro %}

&amp;lt;!-- macro call in a loop in a custom module --&amp;gt;
{{ readingtime(content.post_body) }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;To resolve this behaviour i came along to the&amp;nbsp;&lt;A title="Documentation of string filter escape_jinjava" href="http://escape_jinjava" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;escape_jinjava&lt;/SPAN&gt;&lt;/A&gt; filter.&lt;BR /&gt;It seems, that the problem doesn't occure anymore because of escaping those braces used in hubl templates.&lt;BR /&gt;&lt;BR /&gt;Did someone experienced the same problem or has a reference where this problem is described in detail? I couldn't find a documentation or community post about this topic.&lt;BR /&gt;Greetings &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 09:16:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752622#M32726</guid>
      <dc:creator>JanRa</dc:creator>
      <dc:date>2023-02-07T09:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: DisabledException: 'module' is disabled in this context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752660#M32727</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/402903"&gt;@JanRa&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this reading time script&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{% set initialPostWords = content.post_body|striptags|wordcount %}
         {% set calculatedPostWords = (initialPostWords/100) * 100 %}
         {% set finishedPostWords = calculatedPostWords|divide(300)|round(2) %}


{{ finishedPostWords|round }}&lt;/LI-CODE&gt;
&lt;P&gt;using it for years and never had issues with it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;best,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anton&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 10:28:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752660#M32727</guid>
      <dc:creator>Anton</dc:creator>
      <dc:date>2023-02-07T10:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: DisabledException: 'module' is disabled in this context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752822#M32740</link>
      <description>&lt;P&gt;I also found this snippet while debugging, but it didn't solve the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 15:20:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/DisabledException-module-is-disabled-in-this-context/m-p/752822#M32740</guid>
      <dc:creator>JanRa</dc:creator>
      <dc:date>2023-02-07T15:20:02Z</dc:date>
    </item>
  </channel>
</rss>

