# Simple Custom Module not being rendered correctly

**URL:** <https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920>\
**Category:** CMS Development\
**Created:** [February 11, 2019, 12:49pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920 "2019-02-11T12:49:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![agency\_boon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agency_boon/32/58551_2.png) [@agency\_boon](https://community.hubspot.com/u/agency_boon)\
**Post date:** [February 11, 2019, 12:49pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/1 "2019-02-11T12:49:27Z")

</div>

Hey guys,  
I have this simple HubL custom module, that loads a different Global Group depending on the option you select:

```auto
{% if widget.header == "static-menu" %}
 {% include 'generated_global_groups/3193221022.html' %}
{% elif widget.header == "dynamic-menu" %}
 {% include 'generated_global_groups/3162082770.html' %} 
{% elif widget.header == "med-services-menu" %}
 {% include 'generated_global_groups/3970705183.html' %}
{% elif widget.header == "mba-services-menu" %}
 {% include 'generated_global_groups/4046661496.html' %}
{% elif widget.header == "grad-services-menu" %}
 {% include 'generated_global_groups/4102282733.html' %} 
{% elif widget.header == "law-services-menu" %}
 {% include 'generated_global_groups/4102272583.html' %}
{% elif widget.header == "college-services-menu" %}
 {% include 'generated_global_groups/4182384903.html' %}
{% elif widget.header == "no-menu" %}
 {% include 'generated_global_groups/5431720649.html' %} 
{% endif %}

```

The problem I keep running into is that it doesn’t render correctly on the Front End. Here’s how the Global Group that’s supposed to be rendered looks like in the backend:  
[https://d.pr/i/66GRJ6](https://d.pr/i/66GRJ6)  
Now, if this Global Group get’s rendered using the {% include %} syntax mentioned above, it doesn’t render the CTA module and the New Homepage Popup module correctly and it looks like this:  
[https://d.pr/i/ZxiYsR](https://d.pr/i/ZxiYsR)  
Curiously enough, it renders the module’s outer html and custom classes, but not the modules themselves.  
Here comes the stranger part, if I include in the page the Global Group itself by adding it to the Page Template everything renders fine, here’s how it looks:  
[https://d.pr/i/XM6pgb](https://d.pr/i/XM6pgb)  
I’ve tried discussing this with HubSpot support but they sent me here to the forum saying that this is beyond their scope. I’ve searched through the forum and found that the {% include %} syntax used in the Custom Module is the proper way of inserting Global Groups in a Custom Module using HubL.  
Is there something I’m missing? It seems to me like this is a server error, has anyone experienced something similiar to this?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [February 12, 2019, 12:58am UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/2 "2019-02-12T00:58:23Z")

</div>

[@agency\_boon](https://community.hubspot.com/t5/user/viewprofilepage/user-id/85911)

in your custom module, do you use a choice field for the selection?

I would try changing widget.header to module.header.

I tested in my acct and it works for me. Hope that solves it!

---

<div class="post-metadata">

**Author:** ![agency\_boon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agency_boon/32/58551_2.png) [@agency\_boon](https://community.hubspot.com/u/agency_boon)\
**Post date:** [February 12, 2019, 7:28am UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/3 "2019-02-12T07:28:42Z")

</div>

Hi @dennisedson ,  
Thank you for your response. I tried your suggestion and I still get the same error. The Global Module doesn’t render correctly.  
Is there any way to force the regeneration of the

`generated_global_groups/4046661496.html`

html for the Global Module? Could that be the issue?  
Alex

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [February 12, 2019, 2:32pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/4 "2019-02-12T14:32:23Z")

</div>

Just to make sure your statement is working, why not remove the includes and have some simple text in there.

so instead of this:

```auto
{% if widget.header == "static-menu" %}
 {% include 'generated_global_groups/3193221022.html' %}
{% elif widget.header == "dynamic-menu" %}
 {% include 'generated_global_groups/3162082770.html' %} 
{% elif widget.header == "med-services-menu" %}
 {% include 'generated_global_groups/3970705183.html' %}
{% elif widget.header == "mba-services-menu" %}
 {% include 'generated_global_groups/4046661496.html' %}
{% elif widget.header == "grad-services-menu" %}
 {% include 'generated_global_groups/4102282733.html' %} 
{% elif widget.header == "law-services-menu" %}
 {% include 'generated_global_groups/4102272583.html' %}
{% elif widget.header == "college-services-menu" %}
 {% include 'generated_global_groups/4182384903.html' %}
{% elif widget.header == "no-menu" %}
 {% include 'generated_global_groups/5431720649.html' %} 
{% endif %}

```

change to

```auto
{% if widget.header == "static-menu" %}
a
{% elif widget.header == "dynamic-menu" %}
 b
{% elif widget.header == "med-services-menu" %}
 c
{% elif widget.header == "mba-services-menu" %}
 e
{% elif widget.header == "grad-services-menu" %}
 f
{% elif widget.header == "law-services-menu" %}
 g
{% elif widget.header == "college-services-menu" %}
 h
{% else widget.header == "no-menu" %}
 i
{% endif %}

```

and see if any of that renders. If it does, we have at least narrowed down the issue a bit

(i also changed your last elif to an else. i dont think that is the culprit, but is how it should end)

---

<div class="post-metadata">

**Author:** ![agency\_boon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agency_boon/32/58551_2.png) [@agency\_boon](https://community.hubspot.com/u/agency_boon)\
**Post date:** [February 12, 2019, 3:13pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/5 "2019-02-12T15:13:43Z")

</div>

The statement works, I’ve tested it.  
And thank you for the suggestion about the last elif, but if I change the last elif to else I get this error and can’t publish the module:

**1.Error:“custom\_widget” is disabled in this context**

This happens even if I remove the condition from the statement like so:

```auto
{% if widget.header == "static-menu" %}
 {% include 'generated_global_groups/3193221022.html' %}
{% elif widget.header == "dynamic-menu" %}
 {% include 'generated_global_groups/3162082770.html' %} 
{% elif widget.header == "med-services-menu" %}
 {% include 'generated_global_groups/3970705183.html' %}
{% elif widget.header == "mba-services-menu" %}
 {% include 'generated_global_groups/4046661496.html' %}
{% elif widget.header == "grad-services-menu" %}
 {% include 'generated_global_groups/4102282733.html' %} 
{% elif widget.header == "law-services-menu" %}
 {% include 'generated_global_groups/4102272583.html' %}
{% elif widget.header == "college-services-menu" %}
 {% include 'generated_global_groups/4182384903.html' %}
{% else %}
 {% include 'generated_global_groups/5431720649.html' %} 
{% endif %}

```

Does this point to something more useful?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [February 12, 2019, 3:40pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/6 "2019-02-12T15:40:22Z")

</div>

[@agency\_boon](https://community.hubspot.com/t5/user/viewprofilepage/user-id/85911) , i just tested and it failed for me as well 😞

you should visit the slack channel. Hubspot devs are actively participating in it.

sorry couldnt help you more

---

<div class="post-metadata">

**Author:** ![agency\_boon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agency_boon/32/58551_2.png) [@agency\_boon](https://community.hubspot.com/u/agency_boon)\
**Post date:** [February 13, 2019, 7:25am UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/7 "2019-02-13T07:25:49Z")

</div>

@dennisedson  
Thanks for all your help, how can I get access to the Slack Channel?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [February 13, 2019, 4:17pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/8 "2019-02-13T16:17:52Z")

</div>

[@agency\_boon](https://community.hubspot.com/t5/user/viewprofilepage/user-id/85911) , should be able to find it [here](https://designers.hubspot.com/discoverykit)

[@Tim\_Joyce\_Belch](https://community.hubspot.com/t5/user/viewprofilepage/user-id/81238) , maybe you have an answer for this. It doesnt appear to work for me, either

---

<div class="post-metadata">

**Author:** ![agency\_boon](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/agency_boon/32/58551_2.png) [@agency\_boon](https://community.hubspot.com/u/agency_boon)\
**Post date:** [February 14, 2019, 8:47am UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/9 "2019-02-14T08:47:57Z")

</div>

@dennisedson Thanks you for the Slack Channel.  
looking forward to finding an answer to this cunundrum…

---

<div class="post-metadata">

**Author:** ![Jenny](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jenny/32/24_2.png) [@Jenny](https://community.hubspot.com/u/Jenny)\
**Post date:** [February 14, 2019, 9:24pm UTC](https://community.hubspot.com/t/simple-custom-module-not-being-rendered-correctly/12920/10 "2019-02-14T21:24:33Z")

</div>

Be sure to share your findings back here to help others down the road 🙂

Thanks!
