Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CONTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ It is possible to add pictures to your posts in markdown. First you need to drop
```jinja
{{ figure(
img="/blog/img/your-picture-name.avif"
caption="A description of the picture")
}}
caption="A description of the picture" # can be set to an empty string
alt="A picture description for screen readers" # optional, should only be used when leaving the caption empty
) }}
```

This shortcode ensures that images have a consistent look across posts.
Expand Down
4 changes: 2 additions & 2 deletions templates/shortcodes/figure.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<figure style="height:100%;">
<img src="{{ img }}" alt="{{ caption }}" />
<img src="{{ img }}" {% if alt %}alt="{{ alt }}{% endif %}" />
<figcaption>{{ caption | markdown | safe }}</figcaption>
</figure>
</figure>