Closed bigskillet closed 3 years ago
You want to check if the media type is image or not. media_type Can be IMAGE, VIDEO, or CAROUSEL_ALBUM.
So you should put a check in your loop
{% for item in craftagram.data %}
{% if item.media_type == "IMAGE %}
<img src={{item.media_url}} />
{% elseif item.media_type == "VIDEO" %}
[..]
{% else ....
[..]
{% endif %}
{% endfor %}
I'm getting broken images in my feed because they're actually videos. How might I create a conditional so that the
<img>
tag switches to a<video>
tag when applicable? Would you mind providing an example? Thanks!