Conditional display based on related collection #6738
-
I have a need to conditionally show some HTML if a related collection has any content. My "products" may or may not have related "reviews" and I want to show a link to the reviews on the product page if any exist. The reviews have a product field that is an ID back to the product. This is the code I have in the Antlers template for the product view:
But that's not working. What am I missing? This is on Statamic 3.2. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I ended up solving this by using a filtered collection tag and adding my conditional HTML on the first iteration. Works great!
|
Beta Was this translation helpful? Give feedback.
I ended up solving this by using a filtered collection tag and adding my conditional HTML on the first iteration. Works great!