Skip to content

Schema output is malformed / invalid / has structural errors #38

@jonoalderson

Description

@jonoalderson

The current schema output is malformed / invalid / has structural errors.

For example:

  • The @version parameter is intended to set the JSON-LD processing mode for the whole document, not to specify a version of a given context (see https://www.w3.org/TR/json-ld11/#json-ld-1-1-processing-mode).
  • Best practice is for a @context to use a URI pattern, which can then also act as the canonical location for that context, and forms the root URI for specific types (e.g., a Person in a @context of https://schema.org/ is shorthand for https://schema.org/Person).
  • Individual timestamp properties are orphaned in an unstructured graph / lack a @type (which I presume is meant to be ArticleTimestamp.
  • URL values should not be escaped.

As such, I'd recommend restructuring the output to align with the following example (based on https://yoast.com/wordpress-5-7/):

Examples

Before

<script type="application/ld+json" class="wordproof-schema">
{
  "@context": {
    "@type":"ArticleTimestamp",
    "@version":"0.2.0"
  },
  "blockchain": "eosio_main",
  "transactionId": "9e72f05cd1f03474db452daa93eccfd90b03c06ce6eaf85efb757eee79f67b46",
  "hash": "451a293ed8eed619a4ed19d81c96fb52c0f4b6499935ccab3cd7d176fce81eb2",
  "title": "WordPress 5.7: What's new in this release?",
  "content": "[...]",
  "date": "2021-03-10T09:29:06+01:00",
  "url": "https:\/\/yoast.com\/wordpress-5-7\/"
}
</script>

After

<script type="application/ld+json" class="wordproof-schema">
{
  "@context": "https://wordproof.com/schema/",
  "@graph": [{
    "@type":"ArticleTimestamp",
    "blockchain": "eosio_main",
    "transactionId": "9e72f05cd1f03474db452daa93eccfd90b03c06ce6eaf85efb757eee79f67b46",
    "hash": "451a293ed8eed619a4ed19d81c96fb52c0f4b6499935ccab3cd7d176fce81eb2",
    "title": "WordPress 5.7: What's new in this release?",
    "content": "[...]",
    "date":"2021-03-10T09:29:06+01:00",
    "url": "https://yoast.com/wordpress-5-7/"
  }]
}
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions