Show Customized CTA on Specific Blog Post


#1

Hi Guys,

I'm new on the Hubspot Technology and I have this task, I need to show the customize CTA that I made on the specific blog post. But I'm having a problem doing it. I tried to use the Hubtl Tags but It's not working maybe because I'm using it wrong,

You can see the attached image I made. I hope you guys can help me.


#3

Hi @Marj_Martinez, one thing I'd highly recommend checking out is the Developer Info you can access on any HubSpot hosted page whose portal you're a user in. Just click on the Sprocket icon in the top right corner of any page and go to "Developer Info". This will show you a JSON representation of the page, and you can use the objects you find in the dev info to create conditional logic or print out certain values.

In your case, you may want to try using content.slug to show the CTA only on that one blog post. It would be something like:

{% if content.slug = "9-unique-event-spaces-in-singapore" %}

// do something

{% endif %}

#4

Hi Connor,

Thanks for reply and suggestion. but I tried it and it's throwing some error on my end see the image attached I hope you can help me.

The error says:

Error:Syntax error in " content.slug = "9-unique-event-spaces-in-singapore" "

warning3.

Error: 10:0 TemplateSyntaxException: Expected IDENTIFIER, found . slug


#5

Whoops! That's my fault @Marj_Martinez - I assumed you were within the blog contents object already. Heeding my own advice, I took a look at the developer info and found you do not need to specify the content object. Here's what your if statement should look like:

{% if slug == "9-unique-event-spaces-in-singapore" %}

Everything else should stay the same.