CMS Development

albertsg
Guide

Refresh module list when loading new partial template

Résolue

Hi guys.

 

I'm testing something and I would like to know if there's a way to refresh the module list in a blog post. Let me put you in context:

 

As you cannot change the template for blog posts, I'm loading partial templates (files) with the correct template (we want some blog posts to have different template) using a custom module. The idea is that every partial template has modules on it that are different from other templates. When I choose the template from the module, the correct template appears but not the modules. If I refresh the page, then the modules appear. Do you know if it's possible to refresh the module list without making the author refresh the page?

 

See GIF below for better understanding of the issue:

giphy

 

The other option could be use only one module that shows/hiddes fields according to the first choice, but then how can I send info from this module to a partial template?

 

Thanks for your help!



Did my answer help you? Mark it as a solution


Do you need help with your site? Book time with me:


Book time with Albert

You can also connect with me on LinkedIn



1 Solution acceptée
albertsg
Solution
Guide

Refresh module list when loading new partial template

Résolue

Hi @lscanlan, thanks for the reply!

 

Regarding the module list refresh, would be awesome if you could ask one of your engineers to take a look at it. If you want to use different modules according to the partial template loaded, you need to refresh the module list somehow, so this would be a nice to have to avoid manual refresh. Yes, you can do everything with one module, but maybe someone needs to use different modules and in that case the automatic refresh will be needed. In my case I just need one module, so I don't need to refresh the module list anymore (I managed to achieve what I wanted with one module only). But I have to admit that would be better for content editors to have everything in different modules, will make things more clear. 

 

And that leads us to the second point, accessing data from the module in the partial templates. After some testing I realized that you can do it, you just need to "call" the data using the same format as in the main template, for example:

{{widget_data.module_1555502881885175.body.choice_field}}

I guess (and hope) this will not work if the partial template is loaded in another template without this module. 

 

If you want/need more details, please feel free to send me a private message.

 

Thank you!



Did my answer help you? Mark it as a solution


Do you need help with your site? Book time with me:


Book time with Albert

You can also connect with me on LinkedIn



Voir la solution dans l'envoi d'origine

0 Votes
2 Réponses
lscanlan
Ancien salarié HubSpot
Ancien salarié HubSpot

Refresh module list when loading new partial template

Résolue

Hey @albertsg,

 

This is a really interesting setup. I don't think there's any way to refresh that module list, although I'm happy to play around with and/or have one of our engineers look at it.

 

To your second question, this might be possible. Honestly I might need to just do some testing on my end. Could you link me to your blog / blog template, just so I can see how you have everything set up? I think that would help me to think through this.

 

Thanks,

Leland

Leland Scanlan

HubSpot Developer Support
0 Votes
albertsg
Solution
Guide

Refresh module list when loading new partial template

Résolue

Hi @lscanlan, thanks for the reply!

 

Regarding the module list refresh, would be awesome if you could ask one of your engineers to take a look at it. If you want to use different modules according to the partial template loaded, you need to refresh the module list somehow, so this would be a nice to have to avoid manual refresh. Yes, you can do everything with one module, but maybe someone needs to use different modules and in that case the automatic refresh will be needed. In my case I just need one module, so I don't need to refresh the module list anymore (I managed to achieve what I wanted with one module only). But I have to admit that would be better for content editors to have everything in different modules, will make things more clear. 

 

And that leads us to the second point, accessing data from the module in the partial templates. After some testing I realized that you can do it, you just need to "call" the data using the same format as in the main template, for example:

{{widget_data.module_1555502881885175.body.choice_field}}

I guess (and hope) this will not work if the partial template is loaded in another template without this module. 

 

If you want/need more details, please feel free to send me a private message.

 

Thank you!



Did my answer help you? Mark it as a solution


Do you need help with your site? Book time with me:


Book time with Albert

You can also connect with me on LinkedIn



0 Votes