Simplify embed to single info line
This commit is contained in:
+3
-13
@@ -28,19 +28,15 @@ function pageTitle(video: VideoEntry): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ogTitle(video: VideoEntry): string {
|
function ogTitle(video: VideoEntry): string {
|
||||||
return mapDisplayName(video.mapName);
|
const parts: string[] = [mapDisplayName(video.mapName)];
|
||||||
}
|
|
||||||
|
|
||||||
function ogDescription(video: VideoEntry): string {
|
|
||||||
const parts: string[] = [formatRunTime(video.runTime)];
|
|
||||||
if (video.tier != null) parts.push(`Tier ${video.tier}`);
|
if (video.tier != null) parts.push(`Tier ${video.tier}`);
|
||||||
|
parts.push(formatRunTime(video.runTime));
|
||||||
return parts.join(" · ");
|
return parts.join(" · ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOgsHtml(video: VideoEntry): string {
|
function buildOgsHtml(video: VideoEntry): string {
|
||||||
const runUrl = `${BASE_URL}/run/${video.id}`;
|
const runUrl = `${BASE_URL}/run/${video.id}`;
|
||||||
const title = ogTitle(video);
|
const title = ogTitle(video);
|
||||||
const description = ogDescription(video);
|
|
||||||
const oembedUrl = `${BASE_URL}/api/oembed/${video.id}`;
|
const oembedUrl = `${BASE_URL}/api/oembed/${video.id}`;
|
||||||
|
|
||||||
const thumbnailUrl = video.thumbnailKey
|
const thumbnailUrl = video.thumbnailKey
|
||||||
@@ -51,7 +47,6 @@ function buildOgsHtml(video: VideoEntry): string {
|
|||||||
let tags =
|
let tags =
|
||||||
` <link rel="alternate" type="application/json+oembed" href="${escapeHtml(oembedUrl)}" title="${escapeHtml(title)}" />\n` +
|
` <link rel="alternate" type="application/json+oembed" href="${escapeHtml(oembedUrl)}" title="${escapeHtml(title)}" />\n` +
|
||||||
` <meta property="og:title" content="${escapeHtml(title)}" />\n` +
|
` <meta property="og:title" content="${escapeHtml(title)}" />\n` +
|
||||||
` <meta property="og:description" content="${escapeHtml(description)}" />\n` +
|
|
||||||
` <meta property="og:url" content="${runUrl}" />\n` +
|
` <meta property="og:url" content="${runUrl}" />\n` +
|
||||||
` <meta property="og:type" content="video.other" />\n` +
|
` <meta property="og:type" content="video.other" />\n` +
|
||||||
` <meta property="og:site_name" content="surf.nathan.rip" />\n` +
|
` <meta property="og:site_name" content="surf.nathan.rip" />\n` +
|
||||||
@@ -72,8 +67,7 @@ function buildOgsHtml(video: VideoEntry): string {
|
|||||||
|
|
||||||
tags +=
|
tags +=
|
||||||
`\n <meta name="twitter:card" content="summary_large_image" />\n` +
|
`\n <meta name="twitter:card" content="summary_large_image" />\n` +
|
||||||
` <meta name="twitter:title" content="${escapeHtml(title)}" />\n` +
|
` <meta name="twitter:title" content="${escapeHtml(title)}" />`;
|
||||||
` <meta name="twitter:description" content="${escapeHtml(description)}" />`;
|
|
||||||
|
|
||||||
if (thumbnailUrl) {
|
if (thumbnailUrl) {
|
||||||
tags += `\n <meta name="twitter:image" content="${thumbnailUrl}" />`;
|
tags += `\n <meta name="twitter:image" content="${thumbnailUrl}" />`;
|
||||||
@@ -86,8 +80,6 @@ export interface OembedResponse {
|
|||||||
type: string;
|
type: string;
|
||||||
version: string;
|
version: string;
|
||||||
title: string;
|
title: string;
|
||||||
author_name: string;
|
|
||||||
author_url: string;
|
|
||||||
provider_name: string;
|
provider_name: string;
|
||||||
provider_url: string;
|
provider_url: string;
|
||||||
thumbnail_url?: string;
|
thumbnail_url?: string;
|
||||||
@@ -106,8 +98,6 @@ export function getOembed(id: string): OembedResponse | null {
|
|||||||
type: "video",
|
type: "video",
|
||||||
version: "1.0",
|
version: "1.0",
|
||||||
title: ogTitle(video),
|
title: ogTitle(video),
|
||||||
author_name: video.playerName,
|
|
||||||
author_url: `https://dashboard.momentum-mod.org/maps/${video.mapName}`,
|
|
||||||
provider_name: "surf.nathan.rip",
|
provider_name: "surf.nathan.rip",
|
||||||
provider_url: BASE_URL,
|
provider_url: BASE_URL,
|
||||||
thumbnail_url: thumbnailUrl,
|
thumbnail_url: thumbnailUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user