mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-29 20:14:02 -06:00
Add og:video tags
This commit is contained in:
parent
9d9597df42
commit
7ff7802aa0
@ -8,7 +8,8 @@ import {
|
|||||||
CONFIG,
|
CONFIG,
|
||||||
STATIC_PATHS,
|
STATIC_PATHS,
|
||||||
STATIC_MAX_AGE,
|
STATIC_MAX_AGE,
|
||||||
OPENGRAPH_AND_OEMBED_COMMENT
|
OPENGRAPH_AND_OEMBED_COMMENT,
|
||||||
|
EMBED_SIZE
|
||||||
} from '../initializers'
|
} from '../initializers'
|
||||||
import { root, readFileBufferPromise, escapeHTML } from '../helpers'
|
import { root, readFileBufferPromise, escapeHTML } from '../helpers'
|
||||||
import { asyncMiddleware } from '../middlewares'
|
import { asyncMiddleware } from '../middlewares'
|
||||||
@ -52,6 +53,7 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
|||||||
|
|
||||||
const videoName = escapeHTML(video.name)
|
const videoName = escapeHTML(video.name)
|
||||||
const videoDescription = escapeHTML(video.description)
|
const videoDescription = escapeHTML(video.description)
|
||||||
|
const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedPath()
|
||||||
|
|
||||||
const openGraphMetaTags = {
|
const openGraphMetaTags = {
|
||||||
'og:type': 'video',
|
'og:type': 'video',
|
||||||
@ -60,6 +62,12 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
|||||||
'og:url': videoUrl,
|
'og:url': videoUrl,
|
||||||
'og:description': videoDescription,
|
'og:description': videoDescription,
|
||||||
|
|
||||||
|
'og:video:url': embedUrl,
|
||||||
|
'og:video:secure_url': embedUrl,
|
||||||
|
'og:video:type': 'text/html',
|
||||||
|
'og:video:width': EMBED_SIZE.width,
|
||||||
|
'og:video:height': EMBED_SIZE.height,
|
||||||
|
|
||||||
'name': videoName,
|
'name': videoName,
|
||||||
'description': videoDescription,
|
'description': videoDescription,
|
||||||
'image': previewUrl,
|
'image': previewUrl,
|
||||||
@ -68,7 +76,10 @@ function addOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoInstance
|
|||||||
'twitter:site': '@Chocobozzz',
|
'twitter:site': '@Chocobozzz',
|
||||||
'twitter:title': videoName,
|
'twitter:title': videoName,
|
||||||
'twitter:description': videoDescription,
|
'twitter:description': videoDescription,
|
||||||
'twitter:image': previewUrl
|
'twitter:image': previewUrl,
|
||||||
|
'twitter:player': embedUrl,
|
||||||
|
'twitter:player:width': EMBED_SIZE.width,
|
||||||
|
'twitter:player:height': EMBED_SIZE.height
|
||||||
}
|
}
|
||||||
|
|
||||||
const oembedLinkTags = [
|
const oembedLinkTags = [
|
||||||
|
@ -37,7 +37,7 @@ async function onSuccess (jobId: number, video: VideoInstance) {
|
|||||||
// Now we'll add the video's meta data to our friends
|
// Now we'll add the video's meta data to our friends
|
||||||
await updateVideoToFriends(remoteVideo, null)
|
await updateVideoToFriends(remoteVideo, null)
|
||||||
|
|
||||||
return
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user