Ronalds Vilciņš

Image caption in Jekyll

If you don’t want to use any plugins (which means you can push it to GitHub directly without generating the site first), you can create a new file named image.html in _includes:

<figure class="image">
  <img src="{{ include.url }}" alt="{{ include.description }}">
  <figcaption>{{ include.description }}</figcaption>

Display the image from your markdown with:

{% include image.html url="/images/bird.jpg" description="Bird" %}

This site is ad-free and doesn’t use trackers. If you’d like to support my writing, I’d love if you could buy me a coffee.