-
Notifications
You must be signed in to change notification settings - Fork 299
This way to a passing Rich Results logo test #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
57bcfce
63fd8e2
ea5a3ef
b14dac4
4cf2722
b217358
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ def publisher | |
|
||
output = { | ||
"@type" => "Organization", | ||
"url" => page_drop.canonical_url, | ||
"logo" => { | ||
"@type" => "ImageObject", | ||
"url" => logo, | ||
|
@@ -84,7 +85,25 @@ def main_entity | |
private :main_entity | ||
|
||
def to_json | ||
to_h.reject { |_k, v| v.nil? }.to_json | ||
# this was what happened before | ||
graph = to_h.reject { |_k, v| v.nil? } | ||
|
||
# assign publisher and remove it from the array | ||
# (because I don't know the meta-programming involved in instantiating it) | ||
benjithaimmortal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
publisher = graph["publisher"] || nil | ||
graph.delete("publisher") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could merge these two lines into one: publisher = graph.delete("publisher") There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ashmaroli I think I don't know enough about Ruby for this one. Sorry!
|
||
|
||
updated_graph = { | ||
"@context" => "https://schema.org", | ||
"@graph" => [graph], | ||
} | ||
if publisher | ||
# .push({"something" => blah}) === << {"something" => blah} | ||
benjithaimmortal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
updated_graph["@graph"] << publisher | ||
end | ||
|
||
# .to_json for the win | ||
updated_graph.to_json | ||
end | ||
|
||
private | ||
|
Uh oh!
There was an error while loading. Please reload this page.