From e5809b8b132613720d79c61533c8715337ddaaab Mon Sep 17 00:00:00 2001 From: Brad Kimmel Date: Mon, 27 Jul 2020 21:47:32 -0400 Subject: [PATCH] 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 --- web/src/chainquery.js | 2 +- web/src/html.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/web/src/chainquery.js b/web/src/chainquery.js index af377a01a..c07fc2be2 100644 --- a/web/src/chainquery.js +++ b/web/src/chainquery.js @@ -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 ' + diff --git a/web/src/html.js b/web/src/html.js index 7796de7c1..e2b541dcc 100644 --- a/web/src/html.js +++ b/web/src/html.js @@ -123,8 +123,20 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}) { head += ``; head += ``; head += ``; + if (claim.channel) { + head += ``; + } head += ``; head += ``; + if (claim.release_time) { + var release = new Date(claim.release_time * 1000).toISOString(); + head += ``; + } + if (claim.duration) { + head += ``; + } else if (claim.audio_duration) { + head += ``; + } if (claim.frame_width && claim.frame_height) { head += ``; head += ``;