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

@ -88,10 +88,16 @@ makeItem root prefix nsfw path info@(Info {title}) = [b|
desc = makeDesc $ descFor nsfw info
image = case previewImage info of
Just (PFull img) -> figure $ pageFile img
Just (PThumb th) -> figure $ thumbFile th
Just (PFull img) -> figure img.desc $ pageFile img
Just (PThumb th) -> figure "full image hidden" $ thumbFile th
Nothing -> ""
figure p = [b|<figure> <a href="$link"><img src="$link/$p"></a> </figure>|]
figure alt p = [b|
<figure aria-describedby=mainimg>
<a href="$link">
<img id=mainimg src="$link/$p" alt="$alt" title="$alt">
</a>
</figure>
|]
makeDesc :: Desc -> Builder
makeDesc NoDesc = ""