From b579cc1c8dd80d91b9340d00eaabcf7d4563843c Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Wed, 29 Mar 2023 11:12:06 -0400 Subject: [PATCH] Fix opengraph meta for small images --- .../templates/layout/_opengraph.html.slime | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/philomena_web/templates/layout/_opengraph.html.slime b/lib/philomena_web/templates/layout/_opengraph.html.slime index ef2638e8..70d09b72 100644 --- a/lib/philomena_web/templates/layout/_opengraph.html.slime +++ b/lib/philomena_web/templates/layout/_opengraph.html.slime @@ -6,6 +6,8 @@ meta name="format-detection" content="telephone=no" - image = @conn.assigns.image - filtered = not image.thumbnails_generated - description = "##{image.id} - #{Philomena.Images.tag_list(image)} - Derpibooru" + - thumb_large = ImageView.thumb_urls(image, false)[:large] + - thumb_rendered = ImageView.thumb_url(image, false, :rendered) meta name="keywords" content=tag_list(image) meta name="description" content=description @@ -25,16 +27,16 @@ meta name="format-detection" content="telephone=no" = cond do - image.image_mime_type == "video/webm" and not filtered -> meta property="og:type" content="video.other" - meta property="og:image" content=ImageView.thumb_url(image, false, :rendered) - meta property="og:video" content=ImageView.thumb_url(image, false, :large) + meta property="og:image" content=thumb_rendered + meta property="og:video" content=thumb_large - image.image_mime_type == "image/svg+xml" and not filtered -> meta property="og:type" content="website" - meta property="og:image" content=ImageView.thumb_url(image, false, :rendered) + meta property="og:image" content=thumb_rendered - not filtered -> meta property="og:type" content="website" - meta property="og:image" content=ImageView.thumb_url(image, false, :large) + meta property="og:image" content=thumb_large - true -> meta property="og:type" content="website"