Increase specificity of og:type (#955)

Doesn't seem to do much, but it is what others do, so might as well be specific.
This commit is contained in:
infinite-persistence 2022-02-23 21:11:57 -08:00 committed by GitHub
parent 2b271730cc
commit 77aa405fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,6 +164,18 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}, referrerQuery) {
getThumbnailCdnUrl(OG_IMAGE_URL) || getThumbnailCdnUrl(OG_IMAGE_URL) ||
`${URL}/public/v2-og.png`; `${URL}/public/v2-og.png`;
const getOgType = (streamType) => {
switch (streamType) {
// https://ogp.me/?fbclid=IwAR0Dr3Rb3tw1W5wjFtuRMZfwewM2vlrSnNp-_ZKlvCzo5nKuX2TuTqt0kU8#types
case 'video':
return 'video.other';
case 'audio':
return 'music.song';
default:
return 'website';
}
};
// Allow for overriding default claim based og metadata // Allow for overriding default claim based og metadata
const title = overrideOptions.title || claimTitle; const title = overrideOptions.title || claimTitle;
const description = overrideOptions.description || claimDescription; const description = overrideOptions.description || claimDescription;
@ -192,7 +204,7 @@ function buildClaimOgMetadata(uri, claim, overrideOptions = {}, referrerQuery) {
head += `<meta property="og:image:height" content="219/">`; head += `<meta property="og:image:height" content="219/">`;
head += `<meta property="og:locale" content="${claimLanguage}"/>`; head += `<meta property="og:locale" content="${claimLanguage}"/>`;
head += `<meta property="og:site_name" content="${SITE_NAME}"/>`; head += `<meta property="og:site_name" content="${SITE_NAME}"/>`;
head += `<meta property="og:type" content="website"/>`; head += `<meta property="og:type" content="${getOgType(value?.stream_type)}"/>`;
head += `<meta property="og:title" content="${title}"/>`; head += `<meta property="og:title" content="${title}"/>`;
head += `<meta name="twitter:title" content="${title}"/>`; head += `<meta name="twitter:title" content="${title}"/>`;
head += `<meta property="og:url" content="${claimPath}"/>`; head += `<meta property="og:url" content="${claimPath}"/>`;