CMS Development

roy
Participant

If-then statement causes syntax error when trying to publish

SOLVE

I'm getting this error when I try to publish a HubSpot webpage:

image.png

 

I'm getting the error regardless of whether or not the "Make this template available for new content" box is checked, and I think it's being caused by this code: 

{% if contact.accepts_medicare = "Yes" %}, including Medicare{% endif %}

 

Someone from support pointed this out to me: "Please note that using personalization variables (contact and company variables) within if statements is not currently supported for email in HubSpot. These variables can be used for logic on COS page and blog templates."

 

But it's a webpage, not an email, so I don't understand why that would be a problem.

 

What am I doing wrong?

0 Upvotes
2 Accepted solutions
roy
Solution
Participant

If-then statement causes syntax error when trying to publish

SOLVE

The problem was that I was using "=" instead of "==". Dumb mistake on my part.

View solution in original post

stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

If-then statement causes syntax error when trying to publish

SOLVE

@roy if it's easier to remember, you could also use the expression equivalent: "is equalto"

 

Stefen Phelps, Community Champion, Kelp Web Developer

View solution in original post

3 Replies 3
roy
Solution
Participant

If-then statement causes syntax error when trying to publish

SOLVE

The problem was that I was using "=" instead of "==". Dumb mistake on my part.

stefen
Solution
Key Advisor | Partner
Key Advisor | Partner

If-then statement causes syntax error when trying to publish

SOLVE

@roy if it's easier to remember, you could also use the expression equivalent: "is equalto"

 

Stefen Phelps, Community Champion, Kelp Web Developer
roy
Participant

If-then statement causes syntax error when trying to publish

SOLVE

Good to know! Thank you, Stefen!