HubL breaks image galleries

New Member

I'm working on a blog template that would allow the publisher to show an image gallery module on a per post basis. In the head of the template I've placed this code:

 {% boolean "gallery_toggle" label='Show Image Gallery', value=False, no_wrapper=True, export_to_template_context=True %}

 

The template had an existing HubSpot Image Gallery module. I added this wrapper to the module:

{% if widget_data.gallery_toggle.value == true %}
<!-- HTML to show when checked -->
{{ html }}
{% else %}

{% endif %}

 

The code works to show or hide the image gallery. The issue I'm facing is that the images already added disappear! I've reached out to the HubSpot support team and they recommended I post my issue here to see if anybody has seen this bug or has a solution.

Reply
0 Upvotes
2 Replies 2
Highlighted
Advisor

Hi @andleymedia,

what template do you use? Is it a free one? Could you provide a preview link(not the Dev-preview link)?

 

 

 

Delete 

 {% boolean "gallery_toggle" label='Show Image Gallery', value=False, no_wrapper=True, export_to_template_context=True %}

from the head of the template. This option is "side-wide" so this is the part which "deletes" the images after you disable it. 

 

Have you tried to change the existing module or write a new one?

 

this is basicly the same thing:

{% if module.show_gallery == true %}
	<!-- HTML to show when checked -->
{% elif %}
<!-- HTML to show when NOT checked -->
{% endif %}

Bildschirmfoto 2019-04-16 um 20.36.14.pnga simple bowlesh widget in the module

Note: the elif-part is not nessesary since you want to just turn it on or off.

 

Furthermore I would suggest to build the module with some repeater-widgets so you don't have to generate multiple widgets with (nearly) the same content...

 

 

Please let me know if you need some help

 

 

regards

Anton








check Did my post help answer your query? Help the Community by marking it as a solution
Community Superstar

Was this issue ever resolved?

 

Thanks in advance.

 

Best,

Frank

#nlmtu

Hope that helps.

 

Best,
Frank

 

MFrankJohnson-dot-com-HubSpot-Community-banner-gif-v20190817

Reply
0 Upvotes