No Code Attached Yet
avatar brianteeman
brianteeman
25 Jul 2023

If you look at the json+ld in the head of your document it is not easy to read (as a human) due to all the escape characters. Are they needed? Looking at the spec it appears we have gone a step too far with escaping the slashes

https://w3c.github.io/json-ld-syntax/#restrictions-for-contents-of-json-ld-script-elements

Hard to read

<script type="application/ld+json">{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/j5.test\/#\/schema\/Organization\/base","url":"https:\/\/j5.test\/"},{"@type":"WebSite","@id":"https:\/\/j5.test\/#\/schema\/WebSite\/base","url":"https:\/\/j5.test\/","name":"5 alive","publisher":{"@id":"https:\/\/j5.test\/#\/schema\/Organization\/base"},"potentialAction":{"@type":"SearchAction","target":"https:\/\/j5.test\/index.php\/en\/search?q={search_term_string}","query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https:\/\/j5.test\/#\/schema\/WebPage\/base","url":"https:\/\/j5.test\/index.php\/en\/","name":"Home","description":null,"isPartOf":{"@id":"https:\/\/j5.test\/#\/schema\/WebSite\/base"},"about":{"@id":"https:\/\/j5.test\/#\/schema\/Organization\/base"},"inLanguage":"en-GB"}]}</script>

Easier to read

<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://j5.test/#/schema/Organization/base","url":"https://j5.test/"},{"@type":"WebSite","@id":"https://j5.test/#/schema/WebSite/base","url":"https://j5.test/","name":"5 alive","publisher":{"@id":"https://j5.test/#/schema/Organization/base"},"potentialAction":{"@type":"SearchAction","target":"https://j5.test/index.php/en/search?q={search_term_string}","query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://j5.test/#/schema/WebPage/base","url":"https://j5.test/index.php/en/","name":"Home","description":null,"isPartOf":{"@id":"https://j5.test/#/schema/WebSite/base"},"about":{"@id":"https://j5.test/#/schema/Organization/base"},"inLanguage":"en-GB"}]}</script>

avatar brianteeman brianteeman - open - 25 Jul 2023
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jul 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Jul 2023
avatar brianteeman brianteeman - change - 25 Jul 2023
The description was changed
avatar brianteeman brianteeman - edited - 25 Jul 2023
avatar HLeithner
HLeithner - comment - 25 Jul 2023

funny I added this code for better debugging in the system plugin:
$schemaString = $schema->toString('JSON', ['bitmask' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE]);

avatar HLeithner HLeithner - change - 25 Jul 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-07-25 21:02:54
Closed_By HLeithner
avatar HLeithner
HLeithner - comment - 25 Jul 2023

I changed the output in #41250

avatar HLeithner HLeithner - close - 25 Jul 2023

Add a Comment

Login with GitHub to post a comment