diff --git a/src/views/general.nim b/src/views/general.nim index fb49f56..6701067 100644 --- a/src/views/general.nim +++ b/src/views/general.nim @@ -42,9 +42,9 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc=""; var theme = prefs.theme.toTheme if "theme" in req.params: 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) - meta(property="twitter:image:src", 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