I have a partial that is used to display an image:

{{ hero_content }}
  <img src="{{ value }}" alt="{{ alt }}" />
{{ /hero_content }}

And, I have a fieldset assigned to the image container:

sections:
  main:
    display: Main
    fields:
      alt:
        type: text
        display: Alt
taxonomies: true
title: 'Standard Image'

With the above setup, the alt attribute value in the html output is blank.

I saw in the documentation that it's possible to create an Asset object and loop through all assets (and their values, such as the alt value) using the below code.

{{ assets:photos }}
  <img src="{{ url }}" alt="{{ alt }}" />
{{ /assets:photos }}

But, I would like to add an alt attribute to a single image.

Is there a way to do that?

Answered by Erin Dalzell! Go to answer.