If-then statement causes syntax error when trying to publish

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?

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

@roy if it’s easier to remember, you could also use the expression equivalent: “is equalto”

Good to know! Thank you, Stefen!