0
0
Fork 0

Add alt text for preview card thumbnails (#26184)

This commit is contained in:
Christian Schmidt 2023-08-03 15:41:51 +02:00 committed by GitHub
parent ca19ea30d4
commit 8da99ffb0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 258 additions and 100 deletions

View file

@ -113,6 +113,7 @@ class LinkDetailsExtractor
title: title || '',
description: description || '',
image_remote_url: image,
image_description: image_alt || '',
type: type,
link_type: link_type,
width: width || 0,
@ -168,6 +169,10 @@ class LinkDetailsExtractor
valid_url_or_nil(opengraph_tag('og:image'))
end
def image_alt
opengraph_tag('og:image:alt')
end
def canonical_url
valid_url_or_nil(link_tag('canonical') || opengraph_tag('og:url'), same_origin_only: true) || @original_url.to_s
end