feat: add optional alt parameter to card shortcode (#899)

Add support for custom alt text on card images to improve accessibility.
The alt parameter is optional and defaults to the card title if not provided,
maintaining backward compatibility with existing implementations.

Fixes #896
This commit is contained in:
Xin
2026-01-04 17:23:33 +00:00
committed by GitHub
parent 9466af337f
commit a128fabaf1
3 changed files with 49 additions and 44 deletions

View File

@@ -3,6 +3,7 @@
{{- $icon := .icon -}}
{{- $subtitle := .subtitle -}}
{{- $image := .image -}}
{{- $alt := .alt | default $title -}}
{{- $width := .width -}}
{{- $height := .height -}}
{{- $imageStyle := .imageStyle -}}
@@ -29,7 +30,7 @@
>
{{- with $image -}}
<img
alt="{{ $title }}"
alt="{{ $alt }}"
class="hextra-card-image"
loading="lazy"
decoding="async"