Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Consider acknowledging the @content attribute #20

Closed
danbri opened this issue May 4, 2017 · 22 comments · Fixed by #40
Closed

Consider acknowledging the @content attribute #20

danbri opened this issue May 4, 2017 · 22 comments · Fixed by #40

Comments

@danbri
Copy link
Contributor

danbri commented May 4, 2017

An @content attribute is used elsewhere in the HTML universe (at least RDFa).

It appears that at schema.org we have mistakenly assumed it was part of Microdata or HTML proper. If you grep for @content appearing alongside @itemprop in the schema.org examples, there are lots of examples which use it. This idiom is intended to allow a more machine-friendly property value be parsed out, while something more appropriate to human audiences is also accessible for non-machines. It may also help with l18n where schema designs contain e.g. English-language strings but the markup is otherwise in another natural language.

@chaals
Copy link
Collaborator

chaals commented May 4, 2017

This would be as a synonym for @value, right? Should we explicitly acknowledge it, or note that it should be processed appropriately but is invalid as content?

@chaals
Copy link
Collaborator

chaals commented May 8, 2017

Looking at that, about 60% are of the examples are valid given that they use meta content="[something]" which is accounted for in the spec already. But that leaves about 40%, where there is some other element.

If the processors actually handle the content attribute for e.g. span or p elements, the required changes are:

  1. add a step before the last one in the algorithm than finds the value, along the lines of

Otherwise, if the element has a value attribute
the value is the value of the element's value attribute

  1. note in the changes to HTML that content becomes a global(?) attribute - or some other expansion of where it is valid

  2. describe what to do with it in the example stuff.

Do you have some test results?

@danbri
Copy link
Contributor Author

danbri commented May 9, 2017

Here's a test

<p itemscope itemtype="http://schema.org/Offer">
 <span itemprop="name">A test description, price is 10000 GBP.</span>
 <span content="10000" itemprop="price">10.000</span>
 <span itemprop="priceCurrency" content="GBP"></span>
</p>

Looking around https://w3c.github.io/html/fullindex.html#attributes-table there are several elements listed in that table for 'value' but not enough to match @content's functionality yet as I understand it.

/cc @gkellogg

@gkellogg
Copy link
Member

gkellogg commented May 9, 2017

According to the Microdata to RDF spec, @content is only used on the meta element, as this is how it was described in the original Microdata spec. Of course RDFa accepts @content on any element.

See microdata-rdf/issues#7.

If you update this in Microdata, we'd also need to update Microdata to RDF (or simply include the RDF conversion bits in the new Microdata spec).

@chaals
Copy link
Collaborator

chaals commented May 9, 2017

The Yandex Structured Data Validator recognised it too.

@gkellogg yes, this would be a substantive change. On the other hand, if that's what happens in reality, it seems to be a reasonable one to make.

@danbri do you have any handy data on the use of @content in the wild, for microdata (as opposed to RDFa)?

@chaals
Copy link
Collaborator

chaals commented May 9, 2017

Here's a test where the answers are clearer - if @content is supported on anything, the price is "Super cheap!!1" and the currency "GBP". Other variations may occur. Again, the [Yandex Structured Data Validator](https://webmaster.yandex.com/tools/microtest/) read both the content` attributes.

<p itemscope itemtype="http://schema.org/Offer">
 <span itemprop="name">A test description, price is 10000 GBP.</span>
 <span content="Super cheap!!1" itemprop="price">10.000</span>
 <b itemprop="priceCurrency" content="GBP">£ Sterling</b>
</p>

@danbri
Copy link
Contributor Author

danbri commented May 9, 2017

Not handy but I could look into it. I guess the central interest is on non-meta elements, maybe ratios would be something I could get shared.

@gkellogg
Copy link
Member

gkellogg commented May 9, 2017

Note that the Content model for span does not include @content, but rather Global Attributes. The Content model for meta, does specifically include @content.

If you want to make @content more generally applicable, you either need to update HTML to make @content a global attribute, or provide for @content as being a global Microdata attribute, similar to @itemprop.

IIRC, we were leveraging off of the HTML content model to use @content on meta (as well as a handful of other data attributes).

Arguably, having @content on span should be flagged as an error by an HTML validator.

@chaals
Copy link
Collaborator

chaals commented May 17, 2017

@gkellogg:

If you want to make @content more generally applicable, you either need to update HTML […], or provide for @content as being a global Microdata attribute, similar to @itemprop.

Yep. And since we are already changing / extending HTML in this spec, I suggest that if we decide we want to do this, we start by stating that for microdata @content is global, and then file an issue to see if HTML will accept that for HTML in general.

@danbri
Copy link
Contributor Author

danbri commented May 17, 2017

@gkellogg if we made @content global, would you be likely to update any implementations to track this?

My understanding is that at least major implementations (Google, Yandex) already treat it as global, and that it addresses practical shortfalls of Microdata. So I'd like to propose we make @content a global HTML attribute.

@gkellogg
Copy link
Member

@danbri, I'd certainly update my implementation. Do you imagine incorporating Microdata to RDF in your Microdata update? If not, we'll need to plan on updating that too.

@gkellogg
Copy link
Member

Note that there are other attributes with special content-like attributes:

  • data and meter use @value which is interpreted as a numeric type
  • object uses @data interpreted as a URI
  • @time uses @datetime.

Of these, it might be worth considering @value to be generic, as there is no other reasonable way to get such datatyped literals out of Microdata.

@gkellogg
Copy link
Member

Linter and Distiller updated to allow @content universally.

@chaals
Copy link
Collaborator

chaals commented May 18, 2017

That seems like we probably should just do this… We've got enough interop to show it can be done easily, we have schema.org examples out there suggesting it and we know that people use that, we have an example that it probably isn't a major imposition on implementations, and in any event RDFa already parses this so it brings us into closer alignment.

I'd like to have the data on usage in the wild, but if #35 lands, I'll happily put this in the spec… (I don't think this conflicts with #35 but they both touch a bunch of places, and I am sure that after landing the two there will be cleanup to do, plus #35 would benefit from a few pairs of thoughtful eyes so a couple of days extra seems wearable). Assigning it to me with the assumption that we will move forward...

@iherman @msporny ping

@chaals chaals assigned chaals and unassigned danbri May 18, 2017
@msporny
Copy link
Member

msporny commented May 18, 2017

+1, adding @content globally sounds fine to me. I'd check with @Hixie to understand why it wasn't included in the first iteration of Microdata (other than it being "allowed" in the content model - what are the validators going to say? Do people care about validating HTML these days? I know we stopped doing this a long time ago at our company).

@Hixie
Copy link

Hixie commented May 18, 2017

It fared poorly in usability studies.

@iherman
Copy link
Member

iherman commented May 18, 2017

@gkellogg on #20 (comment) : I think I would prefer to issue a new release of the RDF conversion document rather than adding it to the core microdata spec. It would create too much (unnecessary) discussion about the role of RDF, and we do not need that.

I am a bit neutral whether the RDF conversion spec should remain a note or become a rec. But I have a mild preference of republishing it in the Web Platform WG.

@iherman
Copy link
Member

iherman commented May 18, 2017

+1 adding @content, too. The example on the numbers are typical use cases where this becomes extremely handy; the human readable text may not always coincide with the machine readable format.

I am not sure when I would update the Microdata parsers in RDFLib and in my Microdata distiller, but I would certainly try to find time for it (however, the prerequisite is to update the RDF conversion document as well.

@chaals
Copy link
Collaborator

chaals commented May 18, 2017

Can we keep the "RDF conversion" question in #3, so this issue is just about whether or not to add @content, please?

@iherman
Copy link
Member

iherman commented May 18, 2017

@chaals, apologies:-)

chaals pushed a commit that referenced this issue May 19, 2017
see #20, #38, #39

Note that if there is a `content` attribute is is selected **in
preference** to another specific attribute, including `src` and `href`
@msporny
Copy link
Member

msporny commented May 24, 2017

@Hixie said:

@content fared poorly in usability studies.

So my +1 to add it is now a +0. Do we either have 1) Data from @Hixie noting the usability studies (doubtful, as Google has not released this data to the public AFAIK), or 2) Demonstration that "@content" is being used across X million sites in Microdata markup.

If we don't have data for either, we're just flying by the seat of our pants (which is usually a bad thing to do spec-wise).

There is another option here, which is to fix the schema.org examples.

@gkellogg
Copy link
Member

@content fared poorly in usability studies.

I've never understood how you can do usability studies on the use of attributes. RDFa allows the use of @content universally, and having it be restricted seems to be less usable than having it universal.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants