From e97266c5d4883a10f68b3685ecc0d1942f54d658 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Thu, 20 Jan 2022 16:50:26 +0000 Subject: [PATCH] fix(json-ld): add missing properties to PodcastSeries object rename episode activity cache --- app/Controllers/EpisodeController.php | 2 +- app/Helpers/seo_helper.php | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/Controllers/EpisodeController.php b/app/Controllers/EpisodeController.php index c0d216fb..2704015c 100644 --- a/app/Controllers/EpisodeController.php +++ b/app/Controllers/EpisodeController.php @@ -112,7 +112,7 @@ class EpisodeController extends BaseController $locale = service('request') ->getLocale(); $cacheName = - "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_{$locale}" . + "page_podcast#{$this->podcast->id}_episode#{$this->episode->id}_activity_{$locale}" . (can_user_interact() ? '_authenticated' : ''); if (! ($cachedView = cache($cacheName))) { diff --git a/app/Helpers/seo_helper.php b/app/Helpers/seo_helper.php index 253711c9..ea6f4993 100644 --- a/app/Helpers/seo_helper.php +++ b/app/Helpers/seo_helper.php @@ -21,16 +21,28 @@ use Melbahja\Seo\Schema\Thing; if (! function_exists('get_podcast_metatags')) { function get_podcast_metatags(Podcast $podcast, string $page): string { + $category = ''; + if ($podcast->category->parent_id !== null) { + $category .= $podcast->category->parent->apple_category . ' > '; + } + $category .= $podcast->category->apple_category; + $schema = new Schema( new Thing('PodcastSeries', [ 'name' => $podcast->title, - 'url' => $podcast->link, + 'headline' => $podcast->title, + 'url' => current_url(), + 'sameAs' => $podcast->link, + 'identifier' => $podcast->guid, 'image' => $podcast->cover->feed_url, 'description' => $podcast->description, 'webFeed' => $podcast->feed_url, - 'author' => new Thing('Person', [ - 'name' => $podcast->publisher, - ]), + 'accessMode' => 'auditory', + 'author' => $podcast->owner_name, + 'creator' => $podcast->owner_name, + 'publisher' => $podcast->publisher, + 'inLanguage' => $podcast->language_code, + 'genre' => $category, ]) ); @@ -70,6 +82,7 @@ if (! function_exists('get_episode_metatags')) { 'description' => $episode->description, 'datePublished' => $episode->published_at->format(DATE_ISO8601), 'timeRequired' => iso8601_duration($episode->audio->duration), + 'duration' => iso8601_duration($episode->audio->duration), 'associatedMedia' => new Thing('MediaObject', [ 'contentUrl' => $episode->audio->file_url, ]),