+import * as Bluebird from 'bluebird'
import * as express from 'express'
import { join } from 'path'
import * as validator from 'validator'
-import * as Bluebird from 'bluebird'
-import {
- CONFIG,
- STATIC_PATHS,
- STATIC_MAX_AGE,
- OPENGRAPH_AND_OEMBED_COMMENT,
- EMBED_SIZE
-} from '../initializers'
-import { root, readFileBufferPromise, escapeHTML } from '../helpers'
+import { escapeHTML, readFileBufferPromise, root } from '../helpers/core-utils'
+import { CONFIG, EMBED_SIZE, OPENGRAPH_AND_OEMBED_COMMENT, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers'
import { asyncMiddleware } from '../middlewares'
import { VideoModel } from '../models/video/video'
}
]
+ const schemaTags = {
+ name: videoNameEscaped,
+ description: videoDescriptionEscaped,
+ duration: video.getActivityStreamDuration(),
+ thumbnailURL: previewUrl,
+ contentURL: videoUrl,
+ embedURL: embedUrl,
+ uploadDate: video.createdAt
+ }
+
let tagsString = ''
Object.keys(openGraphMetaTags).forEach(tagName => {
const tagValue = openGraphMetaTags[tagName]
tagsString += `<link rel="alternate" type="${oembedLinkTag.type}" href="${oembedLinkTag.href}" title="${oembedLinkTag.title}" />`
}
+ tagsString += '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">'
+ tagsString += '<h2>Video: <span itemprop="name">' + schemaTags.name + '</span></h2>'
+
+ Object.keys(schemaTags).forEach(tagName => {
+ const tagValue = schemaTags[tagName]
+ tagsString += `<meta itemprop="${tagName}" content="${tagValue}" />`
+ })
+
+ tagsString += '</div>'
+
return htmlStringPage.replace(OPENGRAPH_AND_OEMBED_COMMENT, tagsString)
}