Use webp for thumbnails when available

This commit is contained in:
Zed
2023-01-09 00:29:59 +01:00
parent 88c6135030
commit cd163b26a3
3 changed files with 13 additions and 14 deletions

View File

@@ -3,6 +3,14 @@ import strutils, strformat
import karax/[karaxdsl, vdom, vstyles]
import ".."/[types, utils]
const smallWebp* = "?name=small&format=webp"
proc getSmallPic*(url: string): string =
result = url
if "?" notin url and not url.endsWith("placeholder.png"):
result &= smallWebp
result = getPicUrl(result)
proc icon*(icon: string; text=""; title=""; class=""; href=""): VNode =
var c = "icon-" & icon
if class.len > 0: c = &"{c} {class}"