Skip to content

Commit

Permalink
Unescape slashes in output
Browse files Browse the repository at this point in the history
JSON LD works without escaping slashes, The examples on schema.org don't use slashes. This makes it easier to read and easier to copy paste urls to test them.
  • Loading branch information
patrickomeara authored Jan 17, 2025
1 parent 355d1ec commit 4f0c0b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function nonceAttr(): string

public function toScript(): string
{
return '<script type="application/ld+json"'.$this->nonceAttr().'>'.json_encode($this->toArray(), JSON_UNESCAPED_UNICODE).'</script>';
return '<script type="application/ld+json"'.$this->nonceAttr().'>'.json_encode($this->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).'</script>';
}

public function jsonSerialize(): mixed
Expand Down

0 comments on commit 4f0c0b3

Please sign in to comment.