mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
Fix opengraph meta for small images
This commit is contained in:
parent
145ee74c69
commit
b579cc1c8d
1 changed files with 6 additions and 4 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue