From f2095eeb14db8db6558812225e5a0638d9fc9cd0 Mon Sep 17 00:00:00 2001 From: Ken D'Ambrosio Date: Tue, 16 Jun 2026 18:58:34 +0000 Subject: Fix OG image for photo links: use thumbnail, drop false dimension tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ?photo= is in the URL, @og_use_media was forcing the full-res image (2-3MB) as the og:image. WhatsApp fetched it but showed no preview, likely due to size or timeout. Now uses the thumbnail. Also removed hardcoded og:image:width/height (1200x630) from individual photo/album pages — those dimensions only apply to the default fallback image and were causing WhatsApp to reject previews when the actual image dimensions didn't match the declared ones. Co-Authored-By: Claude Sonnet 4.6 --- app.rb | 1 - views/layout.erb | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app.rb b/app.rb index 36d98ac..64599c3 100644 --- a/app.rb +++ b/app.rb @@ -445,7 +445,6 @@ def browse_album(rel) if params[:photo] && !params[:photo].empty? photo_name = File.basename(params[:photo]) @og_image_rel = rel.empty? ? photo_name : "#{rel}/#{photo_name}" - @og_use_media = true elsif !rel.empty? first_img = @entries.find { |e| %i[image video].include?(e[:type]) } @og_image_rel = if first_img diff --git a/views/layout.erb b/views/layout.erb index d02a67a..6a85482 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -8,9 +8,12 @@ "> <% if @desc %><% end %> - "> + <% _og_img = og_image_url %> + "> + <% unless _og_img %> + <% end %> -- cgit v1.2.3