Created
October 9, 2019 16:34
-
-
Save sajjadmd/05ee1dda6a4fe2cebbce6ffb1a83c293 to your computer and use it in GitHub Desktop.
SEO script, quick JSON-LD structured data view/check.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
clear(); | |
let results = []; | |
const j = document.querySelectorAll("script[type='application/ld+json']"); | |
const items = j.forEach((i) => { | |
let json = i.innerHTML; | |
try { | |
json = ["OK", "color:green;font-size:13px;", JSON.stringify(JSON.parse(json), null, 2)]; | |
} catch (err) { | |
json = ["ERROR", "color:red;font-size:13px;", json]; | |
} | |
results.push(json); | |
}); | |
for (const J of results) { | |
console.log("%c" + J[0], J[1]); | |
console.log(J[2]); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment