Adding blog tag to recent blog Hubl module


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!


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?


Sure, thanks for helping. Here's the preview page but the HTML is not rendering for the blog images, links etc:

Pasting the full code in here doesnt seem to work so i've shared it here:


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


Thanks so much for this @Derek_Gervais - that's worked perfectly. :+1: