aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/client.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index bb02f5075..c85bd8a5e 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -85,6 +85,8 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {
85 ] 85 ]
86 86
87 const schemaTags = { 87 const schemaTags = {
88 '@context': 'http://schema.org',
89 '@type': 'VideoObject',
88 name: videoNameEscaped, 90 name: videoNameEscaped,
89 description: videoDescriptionEscaped, 91 description: videoDescriptionEscaped,
90 duration: video.getActivityStreamDuration(), 92 duration: video.getActivityStreamDuration(),
@@ -95,25 +97,21 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {
95 } 97 }
96 98
97 let tagsString = '' 99 let tagsString = ''
100
101 // Opengraph
98 Object.keys(openGraphMetaTags).forEach(tagName => { 102 Object.keys(openGraphMetaTags).forEach(tagName => {
99 const tagValue = openGraphMetaTags[tagName] 103 const tagValue = openGraphMetaTags[tagName]
100 104
101 tagsString += `<meta property="${tagName}" content="${tagValue}" />` 105 tagsString += `<meta property="${tagName}" content="${tagValue}" />`
102 }) 106 })
103 107
108 // OEmbed
104 for (const oembedLinkTag of oembedLinkTags) { 109 for (const oembedLinkTag of oembedLinkTags) {
105 tagsString += `<link rel="alternate" type="${oembedLinkTag.type}" href="${oembedLinkTag.href}" title="${oembedLinkTag.title}" />` 110 tagsString += `<link rel="alternate" type="${oembedLinkTag.type}" href="${oembedLinkTag.href}" title="${oembedLinkTag.title}" />`
106 } 111 }
107 112
108 tagsString += '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">' 113 // Schema.org
109 tagsString += '<h2>Video: <span itemprop="name">' + schemaTags.name + '</span></h2>' 114 tagsString += `<script type="application/ld+json">${JSON.stringify(schemaTags)}</script>`
110
111 Object.keys(schemaTags).forEach(tagName => {
112 const tagValue = schemaTags[tagName]
113 tagsString += `<meta itemprop="${tagName}" content="${tagValue}" />`
114 })
115
116 tagsString += '</div>'
117 115
118 return htmlStringPage.replace(OPENGRAPH_AND_OEMBED_COMMENT, tagsString) 116 return htmlStringPage.replace(OPENGRAPH_AND_OEMBED_COMMENT, tagsString)
119} 117}