Support JSON-LD named graph (#31288)

This commit is contained in:
Christian Schmidt authored and GitHub committed 2024-08-06 07:52:47 +00:00
1 parent 135493c0b4
commit e9e63ed203
2 files changed
+29 -11

No files matched your search

+3 -1
View File
@@ -101,7 +101,9 @@ class LinkDetailsExtractor
end
def json
@json ||= root_array(Oj.load(@data)).compact.find { |obj| SUPPORTED_TYPES.include?(obj['@type']) } || {}
@json ||= root_array(Oj.load(@data))
.map { |node| JSON::LD::API.compact(node, 'https://schema.org') }
.find { |node| SUPPORTED_TYPES.include?(node['type']) } || {}
end
end