auto-claude: subtask-1-11 - Extract VideoJsonLd component
This commit is contained in:
+3
-3
@@ -3,7 +3,7 @@
|
||||
"spec": "032-split-large-jsonld-tsx-component-759-lines-into-se",
|
||||
"state": "building",
|
||||
"subtasks": {
|
||||
"completed": 9,
|
||||
"completed": 10,
|
||||
"total": 19,
|
||||
"in_progress": 1,
|
||||
"failed": 0
|
||||
@@ -18,8 +18,8 @@
|
||||
"max": 1
|
||||
},
|
||||
"session": {
|
||||
"number": 11,
|
||||
"number": 1548,
|
||||
"started_at": "2026-01-25T06:23:19.101802"
|
||||
},
|
||||
"last_update": "2026-01-25T06:40:39.653402"
|
||||
"last_update": "2026-01-25T11:16:43.611638"
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { type Locale } from '@/i18n/config';
|
||||
|
||||
// VideoObject Schema for embedded videos
|
||||
interface VideoJsonLdProps {
|
||||
name: string;
|
||||
description: string;
|
||||
thumbnailUrl: string;
|
||||
uploadDate: string;
|
||||
duration?: string; // ISO 8601 format, e.g., "PT1M30S"
|
||||
contentUrl?: string;
|
||||
embedUrl?: string;
|
||||
locale: Locale;
|
||||
}
|
||||
|
||||
export function VideoJsonLd({
|
||||
name,
|
||||
description,
|
||||
thumbnailUrl,
|
||||
uploadDate,
|
||||
duration,
|
||||
contentUrl,
|
||||
embedUrl,
|
||||
locale,
|
||||
}: VideoJsonLdProps) {
|
||||
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://damjan-savic.com';
|
||||
|
||||
const schema: Record<string, unknown> = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'VideoObject',
|
||||
name: name,
|
||||
description: description,
|
||||
thumbnailUrl: thumbnailUrl.startsWith('http') ? thumbnailUrl : `${baseUrl}${thumbnailUrl}`,
|
||||
uploadDate: uploadDate,
|
||||
inLanguage: locale === 'de' ? 'de-DE' : locale === 'sr' ? 'sr-RS' : 'en-US',
|
||||
author: {
|
||||
'@id': `${baseUrl}/#person`,
|
||||
},
|
||||
};
|
||||
|
||||
if (duration) {
|
||||
schema.duration = duration;
|
||||
}
|
||||
|
||||
if (contentUrl) {
|
||||
schema.contentUrl = contentUrl;
|
||||
}
|
||||
|
||||
if (embedUrl) {
|
||||
schema.embedUrl = embedUrl;
|
||||
}
|
||||
|
||||
return (
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user