Hello, I have a recent posts module set up as below but I need it to only pull in posts with the tag 'For landlords' and no others. Is this possible please and if so could someone advise how to update the code to achieve this?
Do you need posts that have exactly that 1 tag? Or do you just need the most recently published posts that have that tag? If you need just the most recently published posts that have that tag, that's a pretty quick fix actually. You're currently pulling in the most recently published posts (regardless of tags) with the blog_recent_posts() function (documented here: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-recent-posts😞
{% set recent_posts = blog_recent_posts('5260207072', 3) %}
{% set recent_posts = blog_recent_tag_posts('5260207072', tag-slug-goes-here, 3) %}
And you'll just need to swap out "tag-slug-goes-here" for the actual slug for the topic you want to use. So for example if you're looking for posts that have a tag of "For landlords", the listing URL for that topic would look something like: https://www.domain.com/blog/tag/for-landlords. So your blog_recent_tag_posts() function would look like: {% set recent_posts = blog_recent_tag_posts('5260207072', for-landlords, 3) %}
And that's all you'll need to change. You're not changing the name of the list that you're generating from your function. So only the posts that get pulled in will change.
Do you need posts that have exactly that 1 tag? Or do you just need the most recently published posts that have that tag? If you need just the most recently published posts that have that tag, that's a pretty quick fix actually. You're currently pulling in the most recently published posts (regardless of tags) with the blog_recent_posts() function (documented here: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-recent-posts😞
{% set recent_posts = blog_recent_posts('5260207072', 3) %}
{% set recent_posts = blog_recent_tag_posts('5260207072', tag-slug-goes-here, 3) %}
And you'll just need to swap out "tag-slug-goes-here" for the actual slug for the topic you want to use. So for example if you're looking for posts that have a tag of "For landlords", the listing URL for that topic would look something like: https://www.domain.com/blog/tag/for-landlords. So your blog_recent_tag_posts() function would look like: {% set recent_posts = blog_recent_tag_posts('5260207072', for-landlords, 3) %}
And that's all you'll need to change. You're not changing the name of the list that you're generating from your function. So only the posts that get pulled in will change.