jsmrtn / craftagram

Grab Instagram content through the Instagram Basic Display API
Other
14 stars 8 forks source link

Add Alt Text To Images #72

Closed ec-propaganda closed 2 weeks ago

ec-propaganda commented 1 month ago

Is there a way to pull captions from the posts and use them as alt text on the img tags? My client's ADA audit is flagging their instagram feed and telling us to add alt tags to images, but I can't find a setting or any documentation about how to do it. TIA!

jsmrtn commented 2 weeks ago

Hi @ec-propaganda,

Apologies for the delay. caption should already be available to you in the returned JSON response.

{% set craftagram = craft.craftagram.getInstagramFeed(10) %}

{% for item in craftagram.data %}
    <img src={{item.media_url}} alt={{item.caption}} />
{% endfor %}

Thanks!