- Added shared Open Graph/Twitter/canonical metadata rendering in [includes/layout.php](/Users/tyemeclifford/Documents/GH/mediaplayer/includes/layout.php).

The main video page now uses the active video’s:title
description
canonical /v/<slug> URL
thumbnail as og:image / twitter:image
image dimensions when available

The standalone embed page also now emits social metadata using the video 
thumbnail.
This commit is contained in:
Ty Clifford
2026-06-25 08:29:13 -04:00
parent a3aa51c4e2
commit 173fe3917e
3 changed files with 98 additions and 3 deletions
+31 -2
View File
@@ -54,7 +54,36 @@ foreach ($player_sources as $player_source) {
if (($player_source['kind'] ?? '') !== 'iframe') $native_player_sources[] = $player_source;
}
render_head('Media — TyClifford.com', '
$site_title = setting('site_title', 'Ty Clifford');
$share_title = $video ? $video['title'] . ' — ' . $site_title : 'Media — ' . $site_title;
$share_description = $video && trim($video['description'] ?? '') !== ''
? trim($video['description'])
: setting('site_sub', 'tyclifford.com / media');
$share_url = $video ? public_absolute_url(public_video_url($video['slug'])) : public_absolute_url(public_home_url());
$share_image = ($video && !empty($video['thumbnail'])) ? public_absolute_url(public_media_url($video['thumbnail'])) : '';
$share_image_width = 0;
$share_image_height = 0;
if ($video && !empty($video['thumbnail']) && function_exists('getimagesize')) {
$share_image_file = MEDIA_DIR . ltrim($video['thumbnail'], '/');
if (is_file($share_image_file)) {
$share_image_size = @getimagesize($share_image_file);
if (is_array($share_image_size)) {
$share_image_width = (int)($share_image_size[0] ?? 0);
$share_image_height = (int)($share_image_size[1] ?? 0);
}
}
}
$share_meta = [
'description' => $share_description,
'url' => $share_url,
'type' => $video ? 'video.other' : 'website',
'image' => $share_image,
'image_alt' => $video ? $video['title'] : $site_title,
'image_width' => $share_image_width,
'image_height' => $share_image_height,
];
render_head($share_title, '
/* ── Catalogue grid ── */
.cat-section { display:flex; flex-direction:column; gap:1rem; }
.cat-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
@@ -267,7 +296,7 @@ render_head('Media — TyClifford.com', '
}
.embed-toggle-btn:hover { color:var(--text-2); border-color:var(--purple); background:rgba(176,96,255,.07); }
.embed-toggle-btn.active { color:var(--purple); border-color:var(--purple); background:rgba(176,96,255,.1); }
');
', $share_meta);
?>
<main class="page" role="main">