I want a variable in my blog listing template such that on clicking a button that variable is changed and according to the value of variable the blog are displayed , according to different categories.
1 First method that I tried
{% set obj1 = {val : “all_post”} %} // declaredd this as a variable in hubspot template
Hey I found a temp method of doing that using CSS.
But now stuck in another problem
{% set Employee_Engagement = blog_recent_tag_posts(‘default’, ‘employee engagement’ , 100) %}
{% for content in Employee_Engagement %}
this is returnng nothing, everything empty here,
but if I am using
{% for content in contents %}
{% if ‘employee engagement’ in content.topic_list|map(‘name’)%}
it is working , but I dont want to use this method cause we have set the limit of 9 post per page and it return max of 9 post
but using the first method we can set a limit of how much post we want manually in hubl
I don’t think blog tags can be have whitespace in them so I would check what the tag_slug is exactly. Chances are it’s probably “employee-engagment”. In which case:
{% set Employee_Engagement = blog_recent_tag_posts('default', 'employee-engagement' , 100) %}
{% for content in Employee_Engagement %} // do things{% endfor %}
Re: your original post @ashadabbas15 I think what you’re trying to do is have a button to show the featured blog post, correct?
Firstly, HubL is executed server-side (before the page is presented to the browser), and so you can’t use HubL functions or update HubL variables on the client-side (from the browser).
To have a button that shows you a specific blog category, in this example “Featured”, when clicked it would look like this:
This will take the user to that blog tag’s listing page. However, it’s not entirely clear what you want so if you could give more detail, I could be more specific/helpful.