From 33aae1f7934e4962116e94e477dbf48e24971f5f Mon Sep 17 00:00:00 2001
From: Yassine Doghri <yassine@doghri.fr>
Date: Sun, 23 Jan 2022 12:14:15 +0000
Subject: [PATCH] fix: add open graph size for podcast images to replace the
 inadequate large format

---
 app/Config/Images.php      |  4 ++++
 app/Helpers/seo_helper.php | 12 ++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/app/Config/Images.php b/app/Config/Images.php
index 449a76d8c8..03814fb290 100644
--- a/app/Config/Images.php
+++ b/app/Config/Images.php
@@ -82,6 +82,10 @@ class Images extends BaseConfig
             'width' => 500,
             'height' => 500,
         ],
+        'og' => [
+            'width' => 1200,
+            'height' => 1200,
+        ],
         'federation' => [
             'width' => 400,
             'height' => 400,
diff --git a/app/Helpers/seo_helper.php b/app/Helpers/seo_helper.php
index 33e4c2ffc8..3a6299e7f7 100644
--- a/app/Helpers/seo_helper.php
+++ b/app/Helpers/seo_helper.php
@@ -51,10 +51,10 @@ if (! function_exists('get_podcast_metatags')) {
         $metatags
             ->title('  ' . $podcast->title . " (@{$podcast->handle})" . ' • ' . lang('Podcast.' . $page))
             ->description(htmlspecialchars($podcast->description))
-            ->image((string) $podcast->cover->large_url)
+            ->image((string) $podcast->cover->og_url)
             ->canonical((string) current_url())
-            ->og('image:width', (string) config('Images')->podcastCoverSizes['large']['width'])
-            ->og('image:height', (string) config('Images')->podcastCoverSizes['large']['height'])
+            ->og('image:width', (string) config('Images')->podcastCoverSizes['og']['width'])
+            ->og('image:height', (string) config('Images')->podcastCoverSizes['og']['height'])
             ->og('locale', $podcast->language_code)
             ->og('site_name', service('settings')->get('App.siteName'))
             ->push('link', [
@@ -98,11 +98,11 @@ if (! function_exists('get_episode_metatags')) {
         $metatags
             ->title($episode->title)
             ->description(htmlspecialchars($episode->description))
-            ->image((string) $episode->cover->large_url, 'player')
+            ->image((string) $episode->cover->og_url, 'player')
             ->canonical($episode->link)
             ->og('site_name', service('settings')->get('App.siteName'))
-            ->og('image:width', (string) config('Images')->podcastCoverSizes['large']['width'])
-            ->og('image:height', (string) config('Images')->podcastCoverSizes['large']['height'])
+            ->og('image:width', (string) config('Images')->podcastCoverSizes['og']['width'])
+            ->og('image:height', (string) config('Images')->podcastCoverSizes['og']['height'])
             ->og('locale', $episode->podcast->language_code)
             ->og('audio', $episode->audio_opengraph_url)
             ->og('audio:type', $episode->audio->file_mimetype)
-- 
GitLab