APIs & Integrations

wmflan39
Contributor

Can I set HubL variables at the page level?

I have a template that I use for ~20 different pages. On each of these pages, there is a paragraph of shared content (global module) that I would like to customize, depending on the page used. Ex: replace {{ this_text }} with “page 1” or “page 2” or “page 3”, depending on the page where the module is used.

I am comfortable with using variables at the template level. Is there any way to do it at the page level?

0 Upvotes
1 Reply 1
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Can I set HubL variables at the page level?

Hi @wmflan39,

Are you looking to store the values (“page 1”, “page 2”, etc) on the template, and only show the relevant value? You could use if statements to only show content on a certain page, like this:

If statements

HubL uses if statements to help define the logic of a template. The syntax of HubL if statements is very similar to conditional logic in Python. If statements are wrapped in statement delimiters, starting with an opening if statement and ending with...

0 Upvotes