Hello,

I want to validate my html5 site and become this errors:

Error: Element meta is missing required attribute content.
<meta itemscope="" itemtype="http://schema.org/BlogPosting" itemid="http://www.example.de/artikel/test" itemref="md1 md2 md3 md4 md5" />

Error: Element meta is missing required attribute itemprop.
<meta itemscope="" itemtype="http://schema.org/BlogPosting" itemid="http://www.example.de/artikel/test" itemref="md1 md2 md3 md4 md5" />

Error: The itemref attribute referenced md3, but there is no element with an id attribute with that value.
<meta itemscope="" itemtype="http://schema.org/BlogPosting" itemid="http://www.example.de/artikel/test" itemref="md1 md2 md3 md4 md5" />

I'm looking for a solution but I don't find it :-(

can you help me to solve it? you can find my site on my profile page.

kind regards
drew

Comments

Anonymous’s picture

Here's what the HTML5 spec says:

If either name, http-equiv, or itemprop is specified, then the content attribute must also be specified. Otherwise, it must be omitted.

It seems to me that the HTML you post is valid according to the spec, since there is no name, http-equiv, or itemprop. I suspect that the validator you are using isn't compliant with the spec on this.

Anonymous’s picture

Category: support » bug

Actually, looking at the spec I realize that one of those elements or charset must be specified. So this should be changed to a span tag or something similar.

drew29’s picture

Hello linclark,

i have test it with w3c validator and the http://html5.validator.nu but I have the same errors.
can you help me to specified the elements or charset?

sorry for my bad english.

kind regards
drew

Anonymous’s picture

Unfortunately, my focus is on D8 at the moment, so I'm not working on patches for microdata. Hopefully someone else can pick this up.

dr.user’s picture

StatusFileSize
new683 bytes

Patch for 7.x-1.0-beta2

dr.user’s picture

Forget about my previous post and check solution in #1947266: Microdata for node are embedded incorrectly

roderik’s picture

Status: Active » Needs review

Actually, I don't agree with 'forget about your previous post':

  • This is a valid patch. That is: theme_microdata_item_meta_tags() still produces invalid output (meta tags in places that generate errors), so it should be fixed, or deleted.
  • And I don't think we can delete it. Regardless of whether node attributes get output in 'their own' divs: theme_microdata_item_meta_tags() still needs to catch & output data for other entity types.

I think it's good to look at these things separately. This patch is, IMHO, ready for committing. Its scope is small. It will fix strange errors that people are getting, and thereby make other issues easier to understand (if they still turn out to be issues, after applying this patch).

Also: the 'move the attributes for nodes to the node DIVs, instead of extra separate tags' solutions in #1947266: Microdata for node are embedded incorrectly are useful to look at, but there are still some pitfalls to be worked out (or at least documented).

roderik’s picture

StatusFileSize
new935 bytes

Ahem. I hadn't seen that that patch was not valid against the current -dev.

Also, this tests on 'itemscope', not 'content' -- to a.o. cover the error reported in #1947266-1: Microdata for node are embedded incorrectly .

Now really 'needs review'.

roderik’s picture

StatusFileSize
new928 bytes

Wow. BIG mistake in rerolling. I blame it on handling too many patches at once ;)

RE-retry.

Oh yeah, and this patch includes the other end of #2037161: Output 'itemscope' instead of 'itemscope=""' for fields....

Anonymous’s picture

StatusFileSize
new628 bytes

I was just posting in #2037161: Output 'itemscope' instead of 'itemscope=""' for fields. as you were posting this.

Can you try the following patch? It just changes the tag that is used when the items are added to the render array, which should do the trick.

roderik’s picture

StatusFileSize
new1.46 KB

Ah, right! I see, all items output there are always items/entities, duh.

My test site confirmed. But "Inspect element" reminded me that spans need to be closed :) One example fix is attached.

(And this time I'm leaving the last hunk in, which is creeping into every patch...)

------

Since we're semi-live fixing today, I'll misuse this issue for some coordination...

If you commit this, then:

* With #1947266: Microdata for node are embedded incorrectly rightfully postponed... there is no practical use for #2036819: Restructure microdata_item() storage anymore. (I still like the concept of doing 'data gathering' before the theming phase, but if all output always stays in $page['content'], there's just no reason.)

I'll probably do a braindump in #1947266 just to record my actions & where I ran into a brick wall, but it won't make a practical difference.

* #2038397: Only create itemrefs and extra properties, for 'real items'. still is a valid issue which will clean up the HTML output, IMHO. If you think so too, after reviewing the issue description... please just put to CNW and I'll reroll.

Anonymous’s picture

StatusFileSize
new1.62 KB

Ah, that's right! I didn't think through the fact that span is not a void tag.

Since there is a defined list of void elements in HTML5, I think I might prefer to check whether the tag is a void element. This patch demonstrates what I'm talking about. Would you mind testing it again?

roderik’s picture

Status: Needs review » Reviewed & tested by the community

Sure.

It works as expected. (And I familiarized myself with the 'end slash' of a void element, and when it's optional, just to be sure. Still learning :) )

Anonymous’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks for catching the tag problem and for testing.

Fixed with commit http://drupalcode.org/project/microdata.git/commit/6739979

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.