We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Jul 31, 2018 7:46 AM
I'm trying to use Hubl to create a recent blog posts module, where the user can choose which tag/topic of blogs to show.
I'm having trouble with the line below - if I simply type in the topic slug (eg. 'press-release') it works, but if I try and add a snippet for fields it doesn't work.
{% set topic_posts = blog_recent_topic_posts('default', 'press-release', 3) %}
eg. the below doesn't work for me - however if I put {{ module.tag_field }} into <p>
it outputs the slug fine.
{% set topic_posts = blog_recent_topic_posts('default', '{{ module.tag_field }}', 3) %}
Any help greatly appreciated!
Solved! Go to Solution.
Aug 20, 2018 6:37 PM
Hi @simon,
So after testing a bit in my own portal, I was able to get a basic proof of concept working like this:
{% set topic_posts = blog_recent_topic_posts('default', module.my_choice, 3) %}
{% for topic_post in topic_posts %}
<div>
{{topic_post.name}}
</div>
{% endfor %}
I think the issue you were encountering was due to the use of nested HubL statement delimiters (i.e. having {{}} inside of {%%}). Can you try removing the handlebars around module.tag_field
? I don't want to make changes to your templates/modules myself.
Aug 20, 2018 6:37 PM
Hi @simon,
So after testing a bit in my own portal, I was able to get a basic proof of concept working like this:
{% set topic_posts = blog_recent_topic_posts('default', module.my_choice, 3) %}
{% for topic_post in topic_posts %}
<div>
{{topic_post.name}}
</div>
{% endfor %}
I think the issue you were encountering was due to the use of nested HubL statement delimiters (i.e. having {{}} inside of {%%}). Can you try removing the handlebars around module.tag_field
? I don't want to make changes to your templates/modules myself.
Aug 21, 2018 9:16 AM
Thanks so much for this @Derek_Gervais - that's worked perfectly.
Aug 3, 2018 11:44 AM
Hi @simon,
Are you getting any errors? Could you give me a link to an example page in HubSpot so that I can take a closer look?
Aug 15, 2018 5:25 AM
Sure, thanks for helping. Here's the preview page but the HTML is not rendering for the blog images, links etc: https://www.whiteoakuk.com/agriculture-tractor-asset-finance?hs_preview=jwdcNxej-6024505628
Pasting the full code in here doesnt seem to work so i've shared it here:
https://jsfiddle.net/uv70ynp3