update opengraph
deploy / build-and-deploy (push) Successful in 40s

This commit is contained in:
bytedream committed 2026-10-31 02:08:46 +01:00
1 parent 30c76a10ab
commit 45b5af9254
2 files changed
+6 -8

No files matched your search

+2 -2
View File
@@ -28,9 +28,9 @@ const { title, description, keywords, openGraph, viewTransition } = Astro.props;
<>
<meta property="og:title" content={title} />
{description && <meta property="og:description" content={description} />}
<meta property="og:url" content={Astro.url.href} />
<meta property="og:url" content={Astro.url.pathname} />
<meta property="og:type" content="website" />
<meta property="og:image" content={new URL(logo512.src, Astro.url).href} />
<meta property="og:image" content={logo512.src} />
</>
)}
<slot name="head" />
+4 -6
View File
@@ -2,6 +2,7 @@
import WebsiteLayout from '@layouts/website/WebsiteLayout.astro';
import VideoPlayer from '@app/website/video/VideoPlayer.svelte';
import { getVideoMetadata, resolveVideo } from '@util/video.ts';
import { BASE_PATH } from 'astro:env/server';
const { name } = Astro.params;
@@ -12,16 +13,13 @@ const metadata = await getVideoMetadata(video);
if (!metadata) return new Response(null, { status: 404 });
const { title, description, width, height, duration } = metadata;
const basePath = import.meta.env.BASE_URL.replace(/\/$/, '');
const streamPath = `${basePath}/video/${encodeURIComponent(video.name)}/stream`;
const streamUrl = new URL(streamPath, Astro.url);
const streamPath = `${BASE_PATH}/video/${encodeURIComponent(video.name)}/stream`;
---
<WebsiteLayout title={`${title} – Video`} description={description ?? undefined}>
<WebsiteLayout title={`${title} - Video`} description={description ?? undefined}>
<Fragment slot="head">
<meta property="og:type" content="video" />
<meta property="og:video" content={streamUrl.href} />
{streamUrl.href.startsWith('https://') && <meta property="og:video:secure_url" content={streamUrl.href} />}
<meta property="og:video" content={streamPath} />
<meta property="og:video:type" content={video.contentType} />
{width && <meta property="og:video:width" content={width.toString()} />}
{height && <meta property="og:video:height" content={height.toString()} />}