Skip to content

Instantly share code, notes, and snippets.

@sskylar
Last active June 8, 2018 16:44
Show Gist options
  • Save sskylar/a217c920ec98ea1784af7393c2237f47 to your computer and use it in GitHub Desktop.
Save sskylar/a217c920ec98ea1784af7393c2237f47 to your computer and use it in GitHub Desktop.
Image alt tags with Siteleaf metadata
title assets
Metadata alt tag example
image caption
/uploads/coffee-dof.jpg
4 bottles of coffee.
<!-- Basic usage -->
{% for asset in page.assets %}
<img src="{{ asset.image }}" alt="{{ asset.caption | escape }}">
{% endfor %}
<!-- You can customize the HTML any way you wish -->
{% for asset in page.assets %}
<figure>
<img src="{{ asset.image }}" alt="{{ asset.caption | escape }}">
<figcaption>{{ asset.caption }}</figcaption>
</figure>
{% endfor %}
@sskylar
Copy link
Author

sskylar commented Jun 8, 2018

Here's how this looks in Siteleaf:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment