From 7335533ce978a3281b76b6ed3675d08dfef1d7ce Mon Sep 17 00:00:00 2001 From: Adam <2030217+adamsdesk@users.noreply.github.com> Date: Tue, 18 Jun 2024 19:42:36 -0600 Subject: [PATCH] fix invalid json-ld image object alt property JSON-LD ImageObject alt property is not recongized as a valid property. Therefore, logically replace the alt property with description without breaking other metadata and then delete it. --- lib/jekyll-seo-tag/json_ld_drop.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jekyll-seo-tag/json_ld_drop.rb b/lib/jekyll-seo-tag/json_ld_drop.rb index d51404f..8f88879 100644 --- a/lib/jekyll-seo-tag/json_ld_drop.rb +++ b/lib/jekyll-seo-tag/json_ld_drop.rb @@ -59,6 +59,15 @@ module Jekyll hash = page_drop.image.to_h hash["url"] = hash.delete("path") hash["@type"] = "imageObject" + + if hash["alt"] && !hash["description"] + hash["description"] = hash["alt"] + end + + if hash["alt"] + hash.delete("alt") + end + hash end