Adding an image alt tag and a caption to the same image

Is the only way to add Alt text / an Alt tag to an image to do it in Markdown as Alt text?

If so, how do I then add an image caption as I would if I used an image card?

Yes, markdown or HTML is currently the only way to add an alt tag. If you want to use captions in markdown/HTML cards then you’d need to use the same markup that the rich-text image card generates, something like this:

<figure class="kg-card kg-card-image kg-card-hascaption">
    <img src="..." alt="..." class="kg-image">
    <figcaption>...</figcaption>
</figure>

Note that you’ll still need to use HTML even in the Markdown card, if you are using markdown make sure that you have a blank line before/after the <figure></figure>

Hello hello,

With the markdown way of doing it, pics are optimized like when uploading through the Koenig editor, but the dynamic resizing won’t work, did I get that right?

@Caucasus-and-Mercury if you are writing the HTML as in the example I gave then you can add classes to the <figure> element to change with width of the image if that’s what you are referring to.

Standard:
<figure class="kg-card kg-card-image">...</figure>

Wide:
<figure class="kg-card kg-card-image kg-width-wide">...</figure>

Full-width:
<figure class="kg-card kg-card-image kg-width-full">...</figure>

Amazing! Thanks Kevin!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

As of Ghost 2.26.0 you no longer need to use Markdown or HTML cards, the image card gives you the option of setting both the caption and alt tag.