aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-09-04 09:52:38 +0200
committerChocobozzz <me@florianbigard.com>2020-09-04 09:52:38 +0200
commit865af3fd7b192bda44dea65c6df125f233424f3e (patch)
treea5df97ee0a816b6e55ec7ee97e8391ca0edf9319 /server/lib
parent2c67b964931d5ba41822ec8b35c964c3d2329b73 (diff)
downloadPeerTube-865af3fd7b192bda44dea65c6df125f233424f3e.tar.gz
PeerTube-865af3fd7b192bda44dea65c6df125f233424f3e.tar.zst
PeerTube-865af3fd7b192bda44dea65c6df125f233424f3e.zip
Add site_name to opengraph tags
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/client-html.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 926d6e93f..b8c87e957 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -32,6 +32,7 @@ type Tags = {
32 numberOfItems: number 32 numberOfItems: number
33 } 33 }
34 34
35 siteName: string
35 title: string 36 title: string
36 url: string 37 url: string
37 description: string 38 description: string
@@ -94,6 +95,7 @@ export class ClientHtml {
94 95
95 const url = WEBSERVER.URL + video.getWatchStaticPath() 96 const url = WEBSERVER.URL + video.getWatchStaticPath()
96 const title = escapeHTML(video.name) 97 const title = escapeHTML(video.name)
98 const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
97 const description = escapeHTML(video.description) 99 const description = escapeHTML(video.description)
98 100
99 const image = { 101 const image = {
@@ -111,7 +113,7 @@ export class ClientHtml {
111 const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary_large_image' 113 const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary_large_image'
112 const schemaType = 'VideoObject' 114 const schemaType = 'VideoObject'
113 115
114 customHtml = ClientHtml.addTags(customHtml, { url, title, description, image, embed, ogType, twitterCard, schemaType }) 116 customHtml = ClientHtml.addTags(customHtml, { url, siteName, title, description, image, embed, ogType, twitterCard, schemaType })
115 117
116 return customHtml 118 return customHtml
117 } 119 }
@@ -139,6 +141,7 @@ export class ClientHtml {
139 141
140 const url = videoPlaylist.getWatchUrl() 142 const url = videoPlaylist.getWatchUrl()
141 const title = escapeHTML(videoPlaylist.name) 143 const title = escapeHTML(videoPlaylist.name)
144 const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
142 const description = escapeHTML(videoPlaylist.description) 145 const description = escapeHTML(videoPlaylist.description)
143 146
144 const image = { 147 const image = {
@@ -158,7 +161,7 @@ export class ClientHtml {
158 const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary' 161 const twitterCard = CONFIG.SERVICES.TWITTER.WHITELISTED ? 'player' : 'summary'
159 const schemaType = 'ItemList' 162 const schemaType = 'ItemList'
160 163
161 customHtml = ClientHtml.addTags(customHtml, { url, embed, title, description, image, list, ogType, twitterCard, schemaType }) 164 customHtml = ClientHtml.addTags(customHtml, { url, siteName, embed, title, description, image, list, ogType, twitterCard, schemaType })
162 165
163 return customHtml 166 return customHtml
164 } 167 }
@@ -206,6 +209,7 @@ export class ClientHtml {
206 customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description)) 209 customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description))
207 210
208 const url = entity.Actor.url 211 const url = entity.Actor.url
212 const siteName = escapeHTML(CONFIG.INSTANCE.NAME)
209 const title = escapeHTML(entity.getDisplayName()) 213 const title = escapeHTML(entity.getDisplayName())
210 const description = escapeHTML(entity.description) 214 const description = escapeHTML(entity.description)
211 215
@@ -219,7 +223,7 @@ export class ClientHtml {
219 const twitterCard = 'summary' 223 const twitterCard = 'summary'
220 const schemaType = 'ProfilePage' 224 const schemaType = 'ProfilePage'
221 225
222 customHtml = ClientHtml.addTags(customHtml, { url, title, description, image, ogType, twitterCard, schemaType }) 226 customHtml = ClientHtml.addTags(customHtml, { url, title, siteName, description, image, ogType, twitterCard, schemaType })
223 227
224 return customHtml 228 return customHtml
225 } 229 }
@@ -322,6 +326,7 @@ export class ClientHtml {
322 private static generateOpenGraphMetaTags (tags: Tags) { 326 private static generateOpenGraphMetaTags (tags: Tags) {
323 const metaTags = { 327 const metaTags = {
324 'og:type': tags.ogType, 328 'og:type': tags.ogType,
329 'og:site_name': tags.siteName,
325 'og:title': tags.title, 330 'og:title': tags.title,
326 'og:image': tags.image.url 331 'og:image': tags.image.url
327 } 332 }