Last active
April 3, 2019 22:38
-
-
Save WilliamIsted/86a81afdd911cd676f9173609571e65a to your computer and use it in GitHub Desktop.
Craft CMS - Show image alt text if it has been set and isn't autogenerated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img{% if image.title | kebab != image.slug %} alt="{{ image.title }}"{% endif %} src="{{ image.getUrl('thumb') }}"> | |
Example Usage: | |
{% if entry.images | length %} | |
{% for image in entry.images %} | |
<img{% if image.title | kebab != image.slug %} alt="{{ image.title }}"{% endif %} src="{{ image.getUrl('thumb') }}"> | |
{% endfor %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment