diff --git a/app/Entities/Episode.php b/app/Entities/Episode.php index 454849e17effc94722967bd60cbf816db2658635..6b4939a5a044b461bd6402558109974b7df102b5 100644 --- a/app/Entities/Episode.php +++ b/app/Entities/Episode.php @@ -50,6 +50,11 @@ class Episode extends Entity */ protected $enclosure_web_url; + /** + * @var string + */ + protected $enclosure_opengraph_url; + /** * Holds text only description, striped of any markdown or html special characters * @@ -220,6 +225,11 @@ class Episode extends Entity return $this->getEnclosureUrl() . '?_from=-+Website+-'; } + public function getEnclosureOpengraphUrl() + { + return $this->getEnclosureUrl() . '?_from=-+Open+Graph+-'; + } + public function getLink() { return base_url( diff --git a/app/Helpers/url_helper.php b/app/Helpers/url_helper.php index 1e35a594abc6b6f6368f459cffb7e306f7ffd817..ec462ca8e46be49f522ca3b6ed0cc99cd5c61f70 100644 --- a/app/Helpers/url_helper.php +++ b/app/Helpers/url_helper.php @@ -20,3 +20,21 @@ if (!function_exists('host_url')) { return false; } } + +if (!function_exists('current_season_url')) { + /** + * Return the podcast URL with season number to use in views + * + * @return string + */ + function current_season_url() + { + $season_query_string = ''; + if (isset($_GET['season'])) { + $season_query_string = '?season=' . $_GET['season']; + } elseif (isset($_GET['year'])) { + $season_query_string = '?year=' . $_GET['year']; + } + return current_url() . $season_query_string; + } +} diff --git a/app/Views/episode.php b/app/Views/episode.php index 93d3166c9497649d94b3c89777d7068064634234..f97ff3872ca7ab6c56f0ca1212eef0017269e8f3 100644 --- a/app/Views/episode.php +++ b/app/Views/episode.php @@ -9,7 +9,23 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link rel="shortcut icon" type="image/png" href="/favicon.ico" /> <link rel="stylesheet" href="/assets/index.css"/> + <link rel="canonical" href="<?= current_url() ?>" /> <script src="/assets/podcast.js" type="module" defer></script> + <meta property="og:title" content="<?= $episode->title ?>" /> + <meta property="og:locale" content="<?= $podcast->language_code ?>" /> + <meta property="og:site_name" content="<?= $podcast->title ?>" /> + <meta property="og:url" content="<?= current_url() ?>" /> + <meta property="article:published_time" content="<?= $episode->published_at ?>" /> + <meta property="article:modified_time" content="<?= $episode->updated_at ?>" /> + <meta property="og:image" content="<?= $episode->image->large_url ?>" /> + <meta property="og:image:width" content="<?= config('Images') + ->largeSize ?>" /> + <meta property="og:image:height" content="<?= config('Images') + ->largeSize ?>" /> + <meta property="og:audio" content="<?= $episode->enclosure_opengraph_url ?>" /> + <meta property="og:audio:type" content="<?= $episode->enclosure_mimetype ?>" /> + <meta property="og:description" content="<?= $episode->description ?>" /> + <meta name="twitter:card" content="summary_large_image" /> </head> <body class="flex flex-col min-h-screen mx-auto"> diff --git a/app/Views/podcast.php b/app/Views/podcast.php index 98258d0dd90237d95932540d3c4e8bcdabcb3ee2..fa25f6025fd47cf24eead916ea2505d382240fe9 100644 --- a/app/Views/podcast.php +++ b/app/Views/podcast.php @@ -10,8 +10,20 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link rel="shortcut icon" type="image/png" href="/favicon.ico" /> <link rel="stylesheet" href="/assets/index.css"/> + <link rel="canonical" href="<?= current_season_url() ?>" /> <link type="application/rss+xml" rel="alternate" title="<?= $podcast->title ?>" href="<?= $podcast->feed_url ?>"/> <script src="/assets/podcast.js" type="module" defer></script> + <meta property="og:title" content="<?= $podcast->title ?>" /> + <meta property="og:locale" content="<?= $podcast->language_code ?>" /> + <meta property="og:site_name" content="<?= $podcast->title ?>" /> + <meta property="og:url" content="<?= current_season_url() ?>" /> + <meta property="og:image" content="<?= $podcast->image->large_url ?>" /> + <meta property="og:image:width" content="<?= config('Images') + ->largeSize ?>" /> + <meta property="og:image:height" content="<?= config('Images') + ->largeSize ?>" /> + <meta property="og:description" content="<?= $episode->description ?>" /> + <meta name="twitter:card" content="summary_large_image" /> </head> <body class="flex flex-col min-h-screen">