Properly set preview card type for tweets with images

This commit is contained in:
Faye Duxovni 2022-01-08 18:37:19 -05:00
parent 1b5e8dd1ad
commit 78c6250cac
1 changed files with 5 additions and 6 deletions

View File

@ -36,7 +36,6 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
rss=""): VNode =
let ogType =
if video.len > 0: "video"
elif rss.len > 0: "object"
elif images.len > 0: "photo"
else: "article"
@ -93,15 +92,15 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
meta(property="og:image", content=image)
meta(property="twitter:image:src", content=image)
if rss.len > 0:
meta(property="twitter:card", content="summary")
else:
meta(property="twitter:card", content="summary_large_image")
if video.len > 0:
meta(property="twitter:card", content="summary_large_image")
meta(property="og:video:url", content=video)
meta(property="og:video:secure_url", content=video)
meta(property="og:video:type", content="text/html")
elif images.len > 0:
meta(property="twitter:card", content="summary_large_image")
else:
meta(property="twitter:card", content="summary")
# this is last so images are also preloaded
# if this is done earlier, Chrome only preloads one image for some reason