I have what seems to be a straightforward if statement that SHOULD be working. I’m throwing in debug code and it still looks like it should work – but isn’t!
We’re using a modified blog as a place for our external reviews (reviews we enter ourselves) and want to list the articles by product type first, then sequentially. To that end, we build an “array” of article IDs that correspond to each products.
That being said, here’s the code:
<h7>{{ pro_review_by_product }}</h7>
{% assign pro_review_by_product = pro_review_by_product | split: "|" %}
{% for pro_review in pro_review_by_product %}
{% assign pro_review_meta = pro_review | split: "^" %}
<h2>{{ pro_review_meta[0] }}</h2>
{% assign pro_review_ids = pro_review_meta[1] | split: "," %}
{% for this_id in pro_review_ids %}
<b>Looking for: "{{ this_id }}"</b>
{% for review in blog.articles %}
<br />"{{ review.id }}"
{% if review.id == this_id %} _**<<<<<-- NOT FUNCTIONING**_
<h1>MATCH FOUND!?</h1>
{% assign use_featured_card = false %}
{% for tag in review.tags %}
{% if tag=="featured" %}
{% assign use_featured_card = true %}
{% break %}
{% endif %}
{% endfor %}
{% if use_featured_card==true %}
{% render 'pro-review-card-featured_SNIP', review: review %}
{% else %}
{% render 'pro-review-card_SNIP', review: review %}
{% endif %}
{% break %}
{% endif %}
{% endfor %}
<br />
{% endfor %}
<br /><br />
{% endfor %}
… and here’s what it is outputting:
I put quotes around the strings to ensure there wasn’t any extraneous data. I tried the to_s and the to_i filter on both, thinking it was some unseen type issue but no joy.
I am very new to Liquid, so all help would be appreciated!
