pass url to oembed and some cleanup
This commit is contained in:
parent
819efc6d93
commit
379baa679d
1 changed files with 5 additions and 3 deletions
|
@ -88,13 +88,15 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
||||||
else:
|
else:
|
||||||
text cfg.title
|
text cfg.title
|
||||||
|
|
||||||
|
let finalizedTitleText = (if ogTitle.len > 0: ogTitle else: titleText)
|
||||||
|
|
||||||
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||||
meta(name="theme-color", content="#1F1F1F")
|
meta(name="theme-color", content="#1F1F1F")
|
||||||
meta(property="og:type", content=ogType)
|
meta(property="og:type", content=ogType)
|
||||||
if video.len > 0:
|
if video.len > 0:
|
||||||
meta(property="og:title", content=stripHtml(desc))
|
meta(property="og:title", content=stripHtml(desc))
|
||||||
else:
|
else:
|
||||||
meta(property="og:title", content=(if ogTitle.len > 0: ogTitle else: titleText))
|
meta(property="og:title", content=finalizedTitleText)
|
||||||
meta(property="og:description", content=stripHtml(desc))
|
meta(property="og:description", content=stripHtml(desc))
|
||||||
meta(property="og:site_name", content="Nitter")
|
meta(property="og:site_name", content="Nitter")
|
||||||
meta(property="og:locale", content="en_US")
|
meta(property="og:locale", content="en_US")
|
||||||
|
@ -122,9 +124,9 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
|
||||||
meta(property="og:video:url", content=video)
|
meta(property="og:video:url", content=video)
|
||||||
meta(property="og:video:secure_url", content=video)
|
meta(property="og:video:secure_url", content=video)
|
||||||
meta(property="og:video:type", content="video/mp4")
|
meta(property="og:video:type", content="video/mp4")
|
||||||
verbatim &"<link rel=\"alternate\" href=\"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(if ogTitle.len > 0: ogTitle else: titleText)}\" type=\"application/json+oembed\" />"
|
verbatim &"<link rel=\"alternate\" href=\"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(finalizedTitleText)}&url={encodeUrl(req.path)}\" type=\"application/json+oembed\" />"
|
||||||
#link(rel="alternate",
|
#link(rel="alternate",
|
||||||
# href=getUrlPrefix(cfg) & "/oembed.json?type=video&title=" & encodeUrl(stripHtml(desc)) & "&user=" & encodeUrl(if ogTitle.len > 0: ogTitle else: titleText),
|
# href=&"{getUrlPrefix(cfg)}/oembed.json?type=video&title={encodeUrl(stripHtml(desc))}&user={encodeUrl(finalizedTitleText)}&url={encodeUrl(req.path)}",
|
||||||
# `type`="application/json+oembed")
|
# `type`="application/json+oembed")
|
||||||
|
|
||||||
# this is last so images are also preloaded
|
# this is last so images are also preloaded
|
||||||
|
|
Loading…
Reference in a new issue