This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
/
_metadata.pug
115 lines (99 loc) · 4.63 KB
/
_metadata.pug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//- Title
if (metadata && metadata.title)
title= metadata.title + ' - ' + settings.appName + ', ' + translate("online_latex_editor")
meta(name="twitter:title", content=metadata.title)
meta(name="og:title", content=metadata.title)
else if (typeof(title) == "undefined")
title= settings.appName + ', '+ translate("online_latex_editor")
meta(name="twitter:title", content=settings.appName + ', '+ translate("online_latex_editor"))
meta(name="og:title", content=settings.appName + ', '+ translate("online_latex_editor"))
else
title= translate(title) + ' - ' + settings.appName + ', ' + translate("online_latex_editor")
//- to do - not translate?
meta(name="twitter:title", content=translate(title))
meta(name="og:title", content=translate(title))
//- Description
if (metadata && metadata.description)
meta(name="description" , content=metadata.description)
meta(itemprop="description" , content=metadata.description)
//-twitter and og descriptions handeled in their sections below
else
meta(name="description", content=translate("site_description"))
meta(itemprop="description", content=translate("site_description"))
//- Image
if (metadata && metadata.image && metadata.image.fields)
//- from the CMS
meta(itemprop="image", content=metadata.image.fields.file.url)
meta(name="image", content=metadata.image.fields.file.url)
else if (metadata && metadata.image_src)
//- pages with custom metadata images, metadata.image_src is the full image URL
meta(itemprop="image", content=metadata.image_src)
meta(name="image", content=metadata.image_src)
else if (settings.overleaf)
//- the default image for Overleaf
meta(itemprop="image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
meta(name="image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
else
//- the default image for ShareLaTeX
meta(itemprop="image", content='/touch-icon-192x192.png')
meta(name="image", content='/touch-icon-192x192.png')
//- Keywords
if (metadata && metadata.keywords)
meta(name="keywords" content=metadata.keywords)
//- Misc
meta(itemprop="name", content=settings.appName + ", the Online LaTeX Editor")
if (metadata && metadata.robotsNoindexNofollow)
meta(name="robots" content="noindex, nofollow")
//- Twitter
meta(name="twitter:card", content=metadata && metadata.twitterCardType ? metadata.twitterCardType : 'summary')
if (settings.social && settings.social.twitter && settings.social.twitter.handle)
meta(name="twitter:site", content="@" + settings.social.twitter.handle)
if (metadata && metadata.twitterDescription)
meta(name="twitter:description", content=metadata.twitterDescription)
else
meta(name="twitter:description", content=translate("site_description"))
if (metadata && metadata.twitterImage && metadata.twitterImage.fields)
//- from the CMS
meta(name="twitter:image", content=metadata.twitterImage.fields.file.url)
meta(name="twitter:image:alt", content=metadata.twitterImage.fields.title)
else if (settings.overleaf)
//- the default image for Overleaf
meta(name="twitter:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
else
//- the default image for ShareLaTeX
meta(name="twitter:image", content='/touch-icon-192x192.png')
//- Open Graph
//- to do - add og:url
if (settings.social && settings.social.facebook && settings.social.facebook.appId)
meta(property="fb:app_id", content=settings.social.facebook.appId)
if (metadata && metadata.openGraphDescription)
meta(property="og:description", content=metadata.openGraphDescription)
else
meta(property="og:description", content=translate("site_description"))
if (metadata && metadata.openGraphImage && metadata.openGraphImage.fields)
//- from the CMS
meta(property="og:image", content=metadata.openGraphImage.fields.file.url)
else if (settings.overleaf)
//- the default image for Overleaf
meta(property="og:image", content=buildImgPath('ol-brand/overleaf_og_logo.png'))
else
//- the default image for ShareLaTeX
meta(property="og:image", content='/touch-icon-192x192.png')
if (metadata && metadata.openGraphType)
meta(property="og:type", metadata.openGraphType)
else
meta(property="og:type", content="website")
if (metadata && metadata.openGraphVideo)
//- from the CMS
meta(property="og:video", content=metadata.openGraphVideo)
//- Viewport
if metadata && metadata.viewport
meta(name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes")
//- Noindex
if settings.robotsNoindex
meta(name="robots" content="noindex")
//- Icons
link(rel="icon", href="/favicon.ico")
link(rel="icon", sizes="192x192", href="/touch-icon-192x192.png")
link(rel="apple-touch-icon-precomposed", href="/apple-touch-icon-precomposed.png")
link(rel="mask-icon", href="/mask-favicon.svg", color="#138A07")