Fields in parameters in related_blog_posts

Hi Everyone,

Hi, I am creating module with recent blog posts for use in website pages and i was wandering if there is a way to insert hubspot field in parameter so user can choose on his own tag that should be conisdered when displaying blog post.
Can i for example do something like that, so insert hubspot field as parameter ’ tags = {{ module.tags }} ’ ???

 <div>

 {% related_blog_posts limit=5, 
 blog_ids="5318086126", 
 tags="Insider",
 blog_post_override="5318086126" 
 %}

 </div>

Hi @DZgliński,

short answer: Yes you can achieve this with a custom module.

It should include

  • blog function
  • select option with all your tags(those can’t be populated automatically)
  • number field for amount (optional)

The custom module code could look something like this

{% set blog = modulele.blog %} {# select the blog #}
{% set tag= module.tag_choice_field %} {# select the tag #}
{% set amount = module.amount_of_posts_displayed %} {# set the amount of displayed posts #}

{% set tag_posts = blog_recent_tag_posts(blog, tag, amount) %}

{% for post in tag_posts %}
{# layout for each individual displayed post #}
<li>{{post.name}}</li> {# example #}
{% endfor %}

hope this helps

best,

Anton