How to use a javascript file variable to the hubspot blog listing template.
SOLVE
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
Jun 10, 20201:28 PM - edited Jun 11, 20204:55 AM
Key Advisor
How to use a javascript file variable to the hubspot blog listing template.
SOLVE
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.
Jun 10, 20201:28 PM - edited Jun 11, 20204:55 AM
Key Advisor
How to use a javascript file variable to the hubspot blog listing template.
SOLVE
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.
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 %}