Skip to content
Snippets Groups Projects
Commit 10bdd912 authored by Daniel Aleksandersen's avatar Daniel Aleksandersen Committed by Eugen Rochko
Browse files

Treat meta[property] as a space-separated list (#10604)

The @property attribute in HTML is a space-separated list of values.
This change normalizes whitespace and finds the desired value in
the list instead of requiring an exact single-value match.

More details:
https://www.ctrl.blog/entry/rdfa-socialmedia-metadata.html
parent 01b1c377
No related branches found
No related tags found
No related merge requests found
......@@ -165,7 +165,7 @@ class FetchLinkCardService < BaseService
end
def meta_property(page, property)
page.at_xpath("//meta[@property=\"#{property}\"]")&.attribute('content')&.value || page.at_xpath("//meta[@name=\"#{property}\"]")&.attribute('content')&.value
page.at_xpath("//meta[contains(concat(' ', normalize-space(@property), ' '), ' #{property} ')]")&.attribute('content')&.value || page.at_xpath("//meta[@name=\"#{property}\"]")&.attribute('content')&.value
end
def lock_options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment