Hola! ¡Tenemos nuestra Comunidad en Español!

Simple Custom Module not being rendered correctly

SOLVE
Highlighted
New Contributor

Hey guys,

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

{% 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

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
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

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?

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Regular Advisor | Platinum Partner

@agency_boon , should be able to find it here

 

@Tim_Joyce_Belch , maybe you have an answer for this.  It doesnt appear to work for me, either

dennis
Reply
0 Upvotes
9 Replies 9
Regular Advisor | Platinum Partner

@agency_boon 

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!

 

dennis
Reply
0 Upvotes
New Contributor

Hi @dennis_e ,

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

Reply
0 Upvotes
Regular Advisor | Platinum Partner

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

so instead of this:

{% 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 

{% 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)

dennis
Reply
0 Upvotes
New Contributor

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:

{% 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?

 

Reply
0 Upvotes
Regular Advisor | Platinum Partner

@agency_boon , i just tested and it failed for me as well Smiley Sad 

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

 

sorry couldnt help you more

dennis
Reply
0 Upvotes
New Contributor

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

Reply
0 Upvotes
Regular Advisor | Platinum Partner

@agency_boon , should be able to find it here

 

@Tim_Joyce_Belch , maybe you have an answer for this.  It doesnt appear to work for me, either

dennis
Reply
0 Upvotes
New Contributor

@dennis_e  Thanks you for the Slack Channel.

looking forward to finding an answer to this cunundrum...

Reply
0 Upvotes
Community Manager

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

 

Thanks!


Did my post help answer your query? Help the Community by marking it as a solution
Reply
0 Upvotes