Show the live show and episode in live.php social cards
While a show is live, the og and twitter descriptions read "<show> - <episode title>" and the image is the show's icon (with the square summary card). Otherwise the station defaults are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
170ae6eed0
commit
9c1a47eb37
1 file changed
+19
-5
@@ -13,6 +13,20 @@ $background = '';
|
|||||||
if ($show && $show['background_image'] && is_file(__DIR__ . '/images/backgrounds/' . basename($show['background_image']))) {
|
if ($show && $show['background_image'] && is_file(__DIR__ . '/images/backgrounds/' . basename($show['background_image']))) {
|
||||||
$background = 'images/backgrounds/' . rawurlencode(basename($show['background_image']));
|
$background = 'images/backgrounds/' . rawurlencode(basename($show['background_image']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Social cards describe the show while it's live, and fall back to the station defaults otherwise
|
||||||
|
$siteUrl = 'https://cyberpunklibrarian.nohost.me/rfe/';
|
||||||
|
$socialDescription = 'Something different. Somewhere else.';
|
||||||
|
$socialImage = $siteUrl . 'images/rfe-social.jpg';
|
||||||
|
$socialCard = 'summary_large_image';
|
||||||
|
if ($show && $show['started_at']) {
|
||||||
|
$socialDescription = $show['name'] . ($show['episode_title'] ? ' - ' . $show['episode_title'] : '');
|
||||||
|
if ($show['icon_image'] && is_file(__DIR__ . '/images/backgrounds/' . basename($show['icon_image']))) {
|
||||||
|
$socialImage = $siteUrl . 'images/backgrounds/' . rawurlencode(basename($show['icon_image']));
|
||||||
|
// Show icons are square, so use the small square card rather than the wide one
|
||||||
|
$socialCard = 'summary';
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<!--
|
<!--
|
||||||
@@ -33,16 +47,16 @@ if ($show && $show['background_image'] && is_file(__DIR__ . '/images/backgrounds
|
|||||||
<meta property="og:url" content="https://cyberpunklibrarian.nohost.me/rfe/live.php">
|
<meta property="og:url" content="https://cyberpunklibrarian.nohost.me/rfe/live.php">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="Radio Free Elsewhere — Live Now">
|
<meta property="og:title" content="Radio Free Elsewhere — Live Now">
|
||||||
<meta property="og:description" content="Something different. Somewhere else.">
|
<meta property="og:description" content="<?= htmlspecialchars($socialDescription, ENT_QUOTES, 'UTF-8') ?>">
|
||||||
<meta property="og:image" content="https://cyberpunklibrarian.nohost.me/rfe/images/rfe-social.jpg">
|
<meta property="og:image" content="<?= htmlspecialchars($socialImage, ENT_QUOTES, 'UTF-8') ?>">
|
||||||
|
|
||||||
<!-- Twitter Meta Tags -->
|
<!-- Twitter Meta Tags -->
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="<?= $socialCard ?>">
|
||||||
<meta property="twitter:domain" content="cyberpunklibrarian.nohost.me">
|
<meta property="twitter:domain" content="cyberpunklibrarian.nohost.me">
|
||||||
<meta property="twitter:url" content="https://cyberpunklibrarian.nohost.me/rfe/live.php">
|
<meta property="twitter:url" content="https://cyberpunklibrarian.nohost.me/rfe/live.php">
|
||||||
<meta name="twitter:title" content="Radio Free Elsewhere — Live Now">
|
<meta name="twitter:title" content="Radio Free Elsewhere — Live Now">
|
||||||
<meta name="twitter:description" content="Something different. Somewhere else.">
|
<meta name="twitter:description" content="<?= htmlspecialchars($socialDescription, ENT_QUOTES, 'UTF-8') ?>">
|
||||||
<meta name="twitter:image" content="https://cyberpunklibrarian.nohost.me/rfe/images/rfe-social.jpg">
|
<meta name="twitter:image" content="<?= htmlspecialchars($socialImage, ENT_QUOTES, 'UTF-8') ?>">
|
||||||
|
|
||||||
<link rel="stylesheet" href="assets/css/main.css" />
|
<link rel="stylesheet" href="assets/css/main.css" />
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user