diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb index bebc9c9fd72..e67be33366d 100644 --- a/app/lib/link_details_extractor.rb +++ b/app/lib/link_details_extractor.rb @@ -245,7 +245,7 @@ class LinkDetailsExtractor end def meta_tag(name) - document.xpath("//meta[@name=\"#{name}\"]").pick('content') + head.xpath('//meta[@name][@content]').find { |el| name.casecmp?(el['name']) }&.attr('content') end def structured_data diff --git a/spec/lib/link_details_extractor_spec.rb b/spec/lib/link_details_extractor_spec.rb index e7f22eddabb..d65942d9023 100644 --- a/spec/lib/link_details_extractor_spec.rb +++ b/spec/lib/link_details_extractor_spec.rb @@ -41,7 +41,7 @@ RSpec.describe LinkDetailsExtractor do