- 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
+26
View File
@@ -34,6 +34,13 @@ foreach ($player_sources as $player_source) {
if (($player_source['kind'] ?? '') !== 'iframe') $native_player_sources[] = $player_source;
}
$meta_title = $video ? $video['title'] . ' — TyClifford.com' : 'Video Player';
$meta_description = $video && trim($video['description'] ?? '') !== '' ? trim($video['description']) : 'TyClifford.com media player';
$meta_url = $video
? public_absolute_url('embed.php?v=' . rawurlencode($video['slug']))
: public_absolute_url('embed.php');
$meta_image = ($video && !empty($video['thumbnail'])) ? public_absolute_url(public_media_url($video['thumbnail'])) : '';
// X-Frame-Options: allow embedding from any origin.
// If you want to restrict, change ALLOWALL to SAMEORIGIN or remove for CSP header instead.
header('X-Frame-Options: ALLOWALL');
@@ -45,6 +52,25 @@ header('Content-Security-Policy: frame-ancestors *');
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= $video ? htmlspecialchars($video['title'], ENT_QUOTES) . ' — TyClifford.com' : 'Video Player' ?></title>
<meta name="description" content="<?= h($meta_description) ?>">
<link rel="canonical" href="<?= h($meta_url) ?>">
<meta property="og:type" content="<?= $video ? 'video.other' : 'website' ?>">
<meta property="og:site_name" content="TyClifford.com">
<meta property="og:title" content="<?= h($meta_title) ?>">
<meta property="og:description" content="<?= h($meta_description) ?>">
<meta property="og:url" content="<?= h($meta_url) ?>">
<?php if ($meta_image !== ''): ?>
<meta property="og:image" content="<?= h($meta_image) ?>">
<meta property="og:image:secure_url" content="<?= h($meta_image) ?>">
<meta property="og:image:alt" content="<?= h($video['title']) ?>">
<?php endif; ?>
<meta name="twitter:card" content="<?= $meta_image !== '' ? 'summary_large_image' : 'summary' ?>">
<meta name="twitter:title" content="<?= h($meta_title) ?>">
<meta name="twitter:description" content="<?= h($meta_description) ?>">
<?php if ($meta_image !== ''): ?>
<meta name="twitter:image" content="<?= h($meta_image) ?>">
<meta name="twitter:image:alt" content="<?= h($video['title']) ?>">
<?php endif; ?>
<link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet"/>
<script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script>
<style>