discord video embed fix

This commit is contained in:
Cynthia Foxwell 2024-07-09 12:51:54 -06:00
parent 5c6b229500
commit 3bff6ec415

View file

@ -44,7 +44,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
theme = req.params["theme"].toTheme
let ogType =
if video.len > 0: "video"
if video.len > 0: "video.other"
elif rss.len > 0: "object"
elif images.len > 0: "photo"
else: "article"
@ -107,17 +107,19 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
let image = getUrlPrefix(cfg) & getPicUrl(url)
meta(property="og:image", content=image)
if video.len == 0:
meta(property="twitter:image:src", content=image)
if rss.len > 0:
meta(property="twitter:card", content="summary")
else:
elif video.len == 0:
meta(property="twitter:card", content="summary_large_image")
if video.len > 0:
meta(property="og:video:url", content=video)
meta(property="og:video:secure_url", content=video)
meta(property="og:video:type", content="text/html")
let videoUrl = getUrlPrefix(cfg) & video
meta(property="og:video:url", content=videoUrl)
meta(property="og:video:secure_url", content=videoUrl)
meta(property="og:video:type", content="video/mp4")
# this is last so images are also preloaded
# if this is done earlier, Chrome only preloads one image for some reason