APIs & Integrations

benji_thecroc
投稿者 | Gold Partner
投稿者 | Gold Partner

If post has specific topic not working

Hi,

I'm trying to get a conditional statement working that I found here - https://designers.hubspot.com/docs/tutorials/how-to-check-for-a-particular-topic-on-a-blog-post

However this doesn't seem to be working whether I use name or slug. I know for sure I'm using the correct name as I have a different conditional statement that checks the topic array list's first value and it matches the name I'm using.

So for example

{% set topictag = content.topic_list[0] %}
{% if topictag == "Growing your business" %}
     Returns True
{% endif %}

However this

{% if 'Growing your business' in content.topic_list|map('name') %}
    True
{% else %}
     False
{% endif %}

Returns false. Any ideas on why this would be?

Thanks

0 いいね!
1件の返信
benji_thecroc
投稿者 | Gold Partner
投稿者 | Gold Partner

If post has specific topic not working

I'm being a dummy.

Had the wrong name and the first conditional was using => rather than ==

All working now.

Thanks.