discord video embed fix
This commit is contained in:
parent
5c6b229500
commit
3bff6ec415
1 changed files with 9 additions and 7 deletions
|
@ -42,9 +42,9 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
||||||
var theme = prefs.theme.toTheme
|
var theme = prefs.theme.toTheme
|
||||||
if "theme" in req.params:
|
if "theme" in req.params:
|
||||||
theme = req.params["theme"].toTheme
|
theme = req.params["theme"].toTheme
|
||||||
|
|
||||||
let ogType =
|
let ogType =
|
||||||
if video.len > 0: "video"
|
if video.len > 0: "video.other"
|
||||||
elif rss.len > 0: "object"
|
elif rss.len > 0: "object"
|
||||||
elif images.len > 0: "photo"
|
elif images.len > 0: "photo"
|
||||||
else: "article"
|
else: "article"
|
||||||
|
@ -107,17 +107,19 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
||||||
|
|
||||||
let image = getUrlPrefix(cfg) & getPicUrl(url)
|
let image = getUrlPrefix(cfg) & getPicUrl(url)
|
||||||
meta(property="og:image", content=image)
|
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:
|
if rss.len > 0:
|
||||||
meta(property="twitter:card", content="summary")
|
meta(property="twitter:card", content="summary")
|
||||||
else:
|
elif video.len == 0:
|
||||||
meta(property="twitter:card", content="summary_large_image")
|
meta(property="twitter:card", content="summary_large_image")
|
||||||
|
|
||||||
if video.len > 0:
|
if video.len > 0:
|
||||||
meta(property="og:video:url", content=video)
|
let videoUrl = getUrlPrefix(cfg) & video
|
||||||
meta(property="og:video:secure_url", content=video)
|
meta(property="og:video:url", content=videoUrl)
|
||||||
meta(property="og:video:type", content="text/html")
|
meta(property="og:video:secure_url", content=videoUrl)
|
||||||
|
meta(property="og:video:type", content="video/mp4")
|
||||||
|
|
||||||
# this is last so images are also preloaded
|
# this is last so images are also preloaded
|
||||||
# if this is done earlier, Chrome only preloads one image for some reason
|
# if this is done earlier, Chrome only preloads one image for some reason
|
||||||
|
|
Loading…
Reference in a new issue