You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.8 KiB
78 lines
3.8 KiB
block facebook-card
|
|
-
|
|
var fbCardImg = `https://${site.domain}/img/social-cards/${site.domain}.png?v=${pkg.version}`;
|
|
var fbContentType = 'website';
|
|
var fbTitle = pageTitle || site.name;
|
|
var fbDescription = pageDescription || site.description;
|
|
var fbVideo, fbVideoWidth, fbVideoHeight;
|
|
|
|
if ((currentView === 'dvr') && (viewName === 'home-player')) {
|
|
// use default social card assigned above
|
|
fbTitle = pageTitle;
|
|
fbDescription = pageDescription;
|
|
} else if (episode && episode.images && episode.images.thumbnail) {
|
|
if (clip && clip.images && clip.images.thumbnail) {
|
|
fbCardImg = `https://${site.domain}/image/${clip.images.thumbnail._id || clip.images.thumbnail}`;
|
|
fbTitle = clip.title;
|
|
fbDescription = clip.description;
|
|
fbContentType = 'video';
|
|
fbVideoEmbedUrl = `https://${site.domain}/dvr/${clip.episode._id}/clip/${clip._id}/embed`;
|
|
fbVideoType = 'video/mp4';
|
|
fbVideoWidth = 960;
|
|
fbVideoHeight = 540;
|
|
} else {
|
|
fbCardImg = `https://${site.domain}/image/${episode.images.thumbnail._id || episode.images.thumbnail}`;
|
|
fbTitle = episode.title;
|
|
fbDescription = episode.description;
|
|
}
|
|
} else if (clip && clip.images && clip.images.thumbnail) {
|
|
fbCardImg = `https://${site.domain}/image/${clip.images.thumbnail._id || clip.images.thumbnail}`;
|
|
fbTitle = clip.title;
|
|
fbDescription = clip.description;
|
|
fbContentType = 'video';
|
|
fbVideoEmbedUrl = `https://${site.domain}/dvr/${clip.episode._id}/clip/${clip._id}/embed`;
|
|
fbVideoType = 'video/mp4';
|
|
fbVideoWidth = 960;
|
|
fbVideoHeight = 540;
|
|
} else if (video && video.images && video.images.thumbnail) {
|
|
fbCardImg = `https://${site.domain}/image/${video.images.thumbnail._id || video.images.thumbnail}`;
|
|
fbTitle = video.title;
|
|
fbDescription = video.description;
|
|
} else if (userProfile) {
|
|
fbCardImg = getUserPictureUrl(userProfile, 'large');
|
|
fbTitle = pageTitle;
|
|
fbDescription = pageDescription;
|
|
} else if (channel && channel.images && channel.images.thumbnail) {
|
|
fbCardImg = `https://${site.domain}/image/${channel.images.thumbnail._id || channel.images.thumbnail}`;
|
|
fbTitle = channel.name;
|
|
fbDescription = channel.description;
|
|
} else if (advertisement && advertisement.content) {
|
|
fbTitle = advertisement.content.title;
|
|
if (advertisement.content.body) {
|
|
fbDescription = marked.parse(advertisement.content.body, { renderer: fullMarkdownRenderer }).trim();
|
|
}
|
|
switch (advertisement.content.mediaType) {
|
|
case 'Image':
|
|
fbCardImg = `https://${site.domain}/image/${advertisement.content.media._id}`;
|
|
break;
|
|
case 'Video':
|
|
if (advertisement.content && advertisement.content.media && advertisement.content.media.images && advertisement.content.media.images.thumbnail) {
|
|
fbCardImg = `https://${site.domain}/image/${advertisement.content.media.images.thumbnail._id || advertisement.content.media.images.thumbnail}`;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
meta(property='og:site_name', content= site.name)
|
|
meta(property='og:type', content= fbContentType)
|
|
if fbContentType === 'video'
|
|
meta(property='og:video', content= fbVideoEmbedUrl)
|
|
meta(property='og:video:type', content= fbVideoType)
|
|
meta(property='og:video:width', content= fbVideoWidth)
|
|
meta(property='og:video:height', content= fbVideoHeight)
|
|
meta(property='og:image', content= fbCardImg)
|
|
meta(property='og:image:alt', content= `${fbTitle} | ${fbDescription}`)
|
|
meta(property='og:url', content= `https://${site.domain}${dtp.request.originalUrl}`)
|
|
meta(property='og:title', content= fbTitle)
|
|
if fbDescription && (fbDescription.length > 0)
|
|
meta(property='og:description', content= fbDescription)
|