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