mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 11:06:30 +00:00
Improve link preview headers
This commit is contained in:
parent
4e1d213488
commit
768642a2cc
1 changed files with 9 additions and 7 deletions
|
@ -35,6 +35,7 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
|
||||||
images: seq[string] = @[]; ogTitle=""; theme=""; rss=""): VNode =
|
images: seq[string] = @[]; ogTitle=""; theme=""; rss=""): VNode =
|
||||||
let ogType =
|
let ogType =
|
||||||
if video.len > 0: "video"
|
if video.len > 0: "video"
|
||||||
|
elif rss.len > 0: "object"
|
||||||
elif images.len > 0: "photo"
|
elif images.len > 0: "photo"
|
||||||
else: "article"
|
else: "article"
|
||||||
|
|
||||||
|
@ -45,15 +46,10 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
|
||||||
opensearchUrl = "http://" & cfg.hostname & "/opensearch"
|
opensearchUrl = "http://" & cfg.hostname & "/opensearch"
|
||||||
|
|
||||||
buildHtml(head):
|
buildHtml(head):
|
||||||
link(rel="preload", type="text/css", href="/css/style.css?v=3", `as`="style")
|
|
||||||
link(rel="preload", type="text/css", href="/css/fontello.css?v=2", `as`="style")
|
|
||||||
link(rel="preload", href="/fonts/fontello.woff2?21002321", `as`="font")
|
|
||||||
|
|
||||||
link(rel="stylesheet", type="text/css", href="/css/style.css?v=3")
|
link(rel="stylesheet", type="text/css", href="/css/style.css?v=3")
|
||||||
link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2")
|
link(rel="stylesheet", type="text/css", href="/css/fontello.css?v=2")
|
||||||
|
|
||||||
if theme.len > 0:
|
if theme.len > 0:
|
||||||
link(rel="preload", type="text/css", href=(&"/css/themes/{theme}.css"), `as`="style")
|
|
||||||
link(rel="stylesheet", type="text/css", href=(&"/css/themes/{theme}.css"))
|
link(rel="stylesheet", type="text/css", href=(&"/css/themes/{theme}.css"))
|
||||||
|
|
||||||
link(rel="apple-touch-icon", sizes="180x180", href="/apple-touch-icon.png")
|
link(rel="apple-touch-icon", sizes="180x180", href="/apple-touch-icon.png")
|
||||||
|
@ -88,8 +84,14 @@ proc renderHead*(prefs: Prefs; cfg: Config; titleText=""; desc=""; video="";
|
||||||
meta(property="og:locale", content="en_US")
|
meta(property="og:locale", content="en_US")
|
||||||
|
|
||||||
for url in images:
|
for url in images:
|
||||||
meta(property="og:image", content=getPicUrl(url))
|
let image = "https://" & cfg.hostname & getPicUrl(url)
|
||||||
meta(property="twitter:card", content="summary_large_image")
|
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:
|
if video.len > 0:
|
||||||
meta(property="og:video:url", content=video)
|
meta(property="og:video:url", content=video)
|
||||||
|
|
Loading…
Reference in a new issue