Add more metadata to content pages.

This adds the following metadata to content pages:

  - Channel name: og:video:series
  - Duration/Audio Duration: og:video:duration
  - Release time: og:video:release_date
This commit is contained in:
Brad Kimmel 2020-07-27 21:47:32 -04:00 committed by Sean Yesmunt
parent 443d7469de
commit e5809b8b13
2 changed files with 13 additions and 1 deletions

View file

@ -26,7 +26,7 @@ module.exports.getClaim = async function getClaim(claimName, claimId, channelNam
let params = [claimName];
let sql =
'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height, claim.fee, ' +
'SELECT channel_claim.name as channel, claim.claim_id, claim.name, claim.description, claim.language, claim.thumbnail_url, claim.title, claim.source_media_type, claim.frame_width, claim.frame_height, claim.fee, claim.release_time, claim.duration, claim.audio_duration, ' +
'repost_channel.name as repost_channel, reposted_claim.claim_id as reposted_claim_id, reposted_claim.name as reposted_name, reposted_claim.description as reposted_description, reposted_claim.language as reposted_language, reposted_claim.thumbnail_url as reposted_thumbnail_url, reposted_claim.title as reposted_title, reposted_claim.source_media_type as reposted_source_media_type, reposted_claim.frame_width as reposted_frame_width, reposted_claim.frame_height as reposted_frame_height, reposted_claim.fee as reposted_fee ' +
'FROM claim ' +
'LEFT JOIN claim channel_claim on claim.publisher_id = channel_claim.claim_id ' +

View file

@ -123,8 +123,20 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) {
head += `<meta property="og:video" content="${videoUrl}" />`;
head += `<meta property="og:video:secure_url" content="${videoUrl}" />`;
head += `<meta property="og:video:type" content="${claim.source_media_type}" />`;
if (claim.channel) {
head += `<meta name="og:video:series" content="${claim.channel}"/>`;
}
head += `<meta name="twitter:card" content="player"/>`;
head += `<meta name="twitter:player" content="${videoUrl}" />`;
if (claim.release_time) {
var release = new Date(claim.release_time * 1000).toISOString();
head += `<meta property="og:video:release_date" content="${release}"/>`;
}
if (claim.duration) {
head += `<meta property="og:video:duration" content="${claim.duration}"/>`;
} else if (claim.audio_duration) {
head += `<meta property="og:video:duration" content="${claim.audio_duration}"/>`;
}
if (claim.frame_width && claim.frame_height) {
head += `<meta property="og:video:width" content="${claim.frame_width}"/>`;
head += `<meta property="og:video:height" content="${claim.frame_height}"/>`;