Skip to content

Commit 78c6250

Browse files
committed
Properly set preview card type for tweets with images
1 parent 1b5e8dd commit 78c6250

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/views/general.nim

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
3636
rss=""): VNode =
3737
let ogType =
3838
if video.len > 0: "video"
39-
elif rss.len > 0: "object"
4039
elif images.len > 0: "photo"
4140
else: "article"
4241

@@ -93,15 +92,15 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
9392
meta(property="og:image", content=image)
9493
meta(property="twitter:image:src", content=image)
9594

96-
if rss.len > 0:
97-
meta(property="twitter:card", content="summary")
98-
else:
99-
meta(property="twitter:card", content="summary_large_image")
100-
10195
if video.len > 0:
96+
meta(property="twitter:card", content="summary_large_image")
10297
meta(property="og:video:url", content=video)
10398
meta(property="og:video:secure_url", content=video)
10499
meta(property="og:video:type", content="text/html")
100+
elif images.len > 0:
101+
meta(property="twitter:card", content="summary_large_image")
102+
else:
103+
meta(property="twitter:card", content="summary")
105104

106105
# this is last so images are also preloaded
107106
# if this is done earlier, Chrome only preloads one image for some reason

0 commit comments

Comments
 (0)