add image descriptions/alt text

This commit is contained in:
rhiannon morris 2024-10-21 14:24:17 +02:00
parent 9d0b1a5eb3
commit 18629cb220
5 changed files with 29 additions and 18 deletions

View file

@ -95,6 +95,8 @@ make' root siteName prefix nsfw _dataDir dir
Just (Artist {name}) -> [b|by $name|]
Nothing -> "by niss"
let alt = image0.desc
let updateDate = ifJust (last' updates) \(d, _) ->
let updated = formatLong d in
[b|<br> <span class=updated>updated $updated</span>|]
@ -156,10 +158,10 @@ make' root siteName prefix nsfw _dataDir dir
$buttonBar
<main>
<figure id=mainfig>
<figure id=mainfig aria-labelledby=mainimg>
$warning'
<a id=mainlink href="$download0" title="download full version">
<img id=mainimg src="$path0'" alt="">
<img id=mainimg src="$path0'" alt="$alt" title="$alt">
</a>
</figure>
@ -297,7 +299,7 @@ altButton :: Image -> Text -> Builder
altButton img i = [b|
<li$nsfwClass>
<input type=radio name=variant id="$i" value="$path'"
data-link="$link"$warning'>
data-link="$link"$warning' data-alt="$alt">
<label for="$i"$nsfwLabelClass>$label</label>
|]
where
@ -307,6 +309,7 @@ altButton img i = [b|
path' = pageFile img
link = fromMaybe (bigFile img) download
warning' = ifJust warning \(escAttr -> w) -> [b|$& data-warning="$w"|]
alt = img.desc
makeTags :: FilePath -> [Strict.Text] -> Builder
makeTags undir tags =