diff options
Diffstat (limited to 'server/controllers/client.ts')
-rw-r--r-- | server/controllers/client.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 39e046727..bb02f5075 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -84,6 +84,16 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) { | |||
84 | } | 84 | } |
85 | ] | 85 | ] |
86 | 86 | ||
87 | const schemaTags = { | ||
88 | name: videoNameEscaped, | ||
89 | description: videoDescriptionEscaped, | ||
90 | duration: video.getActivityStreamDuration(), | ||
91 | thumbnailURL: previewUrl, | ||
92 | contentURL: videoUrl, | ||
93 | embedURL: embedUrl, | ||
94 | uploadDate: video.createdAt | ||
95 | } | ||
96 | |||
87 | let tagsString = '' | 97 | let tagsString = '' |
88 | Object.keys(openGraphMetaTags).forEach(tagName => { | 98 | Object.keys(openGraphMetaTags).forEach(tagName => { |
89 | const tagValue = openGraphMetaTags[tagName] | 99 | const tagValue = openGraphMetaTags[tagName] |
@@ -95,6 +105,16 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) { | |||
95 | tagsString += `<link rel="alternate" type="${oembedLinkTag.type}" href="${oembedLinkTag.href}" title="${oembedLinkTag.title}" />` | 105 | tagsString += `<link rel="alternate" type="${oembedLinkTag.type}" href="${oembedLinkTag.href}" title="${oembedLinkTag.title}" />` |
96 | } | 106 | } |
97 | 107 | ||
108 | tagsString += '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">' | ||
109 | tagsString += '<h2>Video: <span itemprop="name">' + schemaTags.name + '</span></h2>' | ||
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 | |||
98 | return htmlStringPage.replace(OPENGRAPH_AND_OEMBED_COMMENT, tagsString) | 118 | return htmlStringPage.replace(OPENGRAPH_AND_OEMBED_COMMENT, tagsString) |
99 | } | 119 | } |
100 | 120 | ||