Skip to content

Support for <meta itemprop=...> of Schema.org Semantic/Microdata Markup #527

Description

@ilyaigpetrov

There are some approaches to semantic markup, one of them is Schema.org and its microdata.
Here is an example:

This paragraph is closed right after an opening span:
<span itemprop="contentLocation" itemscope itemtype="https://schema.org/City">
  <meta itemprop="name" content="Springfield">
  <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
    <meta itemprop="addressCountry" content="US">
    <span itemprop="addressLocality">Springfield</span>,
    <span itemprop="addressRegion">Oregon</span>
    <meta itemprop="postalCode" content="97477">
  </span>
</span>

As you can see <meta> is used to convey semantic data, more examples of how <meta> is used may be found here on Schema.org.
You may view this snippet on Dingus (copy-paste URL if doesn't work), output of CommonMark is the following:

<p>This paragraph is closed right after an opening span:
<span itemprop="contentLocation" itemscope itemtype="https://schema.org/City"></p>
  <meta itemprop="name" content="Springfield">
  <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
    <meta itemprop="addressCountry" content="US">
    <span itemprop="addressLocality">Springfield</span>,
    <span itemprop="addressRegion">Oregon</span>
    <meta itemprop="postalCode" content="97477">
  </span>
</span>

As you can see the first opening <span> is wrapped into <p> by CommonMark, because:

this accords with the spec (sec. 4.6): commonmark treats the
line with the meta tag as starting a type-6 HTML block, so the preceding
paragraph is closed.

As I read the HTML5 spec
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
it says that meta elements are allowed only in a head
element, with the following exception: if the name
attribute is present, they are allowed “where metadata
content is expected.”

...the example from schema.org that you
link to doesn’t have a name element. Instead, it has
itemprop. The HTML5 spec for meta says:
“Exactly one of the name, http-equiv, and charset
attributes must be specified.” So, I guess this is not
valid HTML5. It might be valid HTML4.

We want to be pragmatic about this, so if this use of
meta tags is common, we should probably exclude the
meta tag from the list of tags in #6 of section 4.6 of
the spec, allowing them to appear as inline content.
Would anyone have objections to this?

All quotations are by @jgm from talk.commonmark.org.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo