I haven’t found any official examples, so I’m unsure whether this approach is valid. In WordPress we can use flexible conditionals for each template; does HubSpot offer anything similar?
Additionally, if the templateType is blog_post, is there a way to add another layer of conditional logic that targets only a specific blog by its ID?
If anyone knows how to handle these conditionals, I’d appreciate your advice.
How do I write conditional logic based on templateType?
SOLVE
Glad to hear that worked for you!
One additional tip - if your theme starts having more page templates in the future, instead of adding each individual template to the "if" statement, you could target all site pages with this logic:
{% if builtin_body_classes is string_containing "hs-site-page" %}
This would apply to any Website Page, regardless of the template.
✔️ Did this post help answer your query? Help the community by marking it as a solution.
How do I write conditional logic based on templateType?
SOLVE
Glad to hear that worked for you!
One additional tip - if your theme starts having more page templates in the future, instead of adding each individual template to the "if" statement, you could target all site pages with this logic:
{% if builtin_body_classes is string_containing "hs-site-page" %}
This would apply to any Website Page, regardless of the template.
✔️ Did this post help answer your query? Help the community by marking it as a solution.