User tests: Successful: Unsuccessful:
When an extension enriches it's content with schema.org meta data, then the W3C validator will complain like
The itemprop attribute was specified, but the element is not a property of any item.
<p itemprop="startDate" content="2015-06-18T21:35:00+00:00">
This situation can easily be solved with the proposed code change.
Status | New | ⇒ | Pending |
Easy | No | ⇒ | Yes |
Category | ⇒ | Front End |
Category | Front End | ⇒ | Front End Templates (site) |
My feeling is that this microdata stuff is getting ridiculous. What value is there to define a HTML page as "webpage"? Aren't all HTML pages webpages?
Even schema.org seem to agree with that (from https://schema.org/WebPage):
A web page. Every web page is implicitly assumed to be declared to be of type WebPage, so the various properties about that webpage, such as breadcrumb may be used. We recommend explicit declaration if these properties are specified, but if they are found outside of an itemscope, they will be assumed to be about the page.
So it should be valid even without that itsemscope.
Your example is probably a bad example, as "startDate" isn't a valid property for a WebPage if I read https://schema.org/startDate correctly. It should be contained in an "Event" type.
The example I've posted is an excerpt of a complete structure within an event which looks like when you install the upcoming module. You can think about this as scopes. A root scope is the WebPage and it can contain other elements like Events and so on. Did you understand it?
The upcoming module creates the following structure, which is valid structured data:
<div itemprop="event" itemscope="" itemtype="http://schema.org/Event">
<p style="clear: both;"></p>
<div class="dp-upcoming-calendar">
<div class="dp-upcoming-calendar-background" style="background-color: #B310CC"></div>
<div class="dp-upcoming-text-month">Jun</div>
<div class="dp-upcoming-text-day" style="color: #B310CC">20</div>
</div>
<p itemprop="startDate" content="2015-06-20T00:00:00+00:00">
06.20.2015 <br>
<a href="/demo/dpc/en/7999.html" itemprop="url" class="dpc-upcoming-event-link">
<span itemprop="name">Full Day Event</span>
</a>
</p>
<div itemscope="" itemtype="http://schema.org/PostalAddress" itemprop="location"><meta itemprop="name" content="Washington"><meta itemprop="addressLocality" content=""><meta itemprop="addressRegion" content=""><meta itemprop="postalCode" content=""><meta itemprop="streetAddress" content=" "><meta itemprop="addressCountry" content="Washington"></div> <p style="clear: both;">
</p></div>
The event
property isn't a valid property for a WebPage neither. See https://schema.org/event.
So while it would please the W3 checker, it still produces wrong structured data and the Google checker (https://developers.google.com/structured-data/testing-tool/) will show it as an error.
I would suggest you just remove the "event" itemprop from your module. This is the real issue as it will be an invalid property on most pages anyway.
This suggestion does not fix and does not really improve something.
I am agree with @Bakual ,
And I do not really understand why you force Event
to be children of WebPage
, it have no any sense.
Just do as in examples https://schema.org/Event
Labels |
Added:
?
|
The problem is that the upcoming module delivers multiple events which must be wrapped inside a root itemprop. The problem is that the W3C validator fails and reports the problems mentioned in the description. The fix is not something it did out of curiosity, but a suggestion from SO http://stackoverflow.com/questions/29123445/validation-error-the-itemprop-attribute-was-specified-but-the-element-is-not. The HTML code generated by the module is absolutely fine.
Removing the property is not a valid option as it is more and more important to deliver structured data beside the HTML code.
Digging a bit further on this, when I wrap multiple events inside a Thing div, then it starts to become valid. So I found a workaround, thanks to your inputs.
I still think it has it's right to to put the whole site inside a WebPage. Structured data is also used by com_content, so it would be ok to us it in a template. I agree with @Fedik that it doesn't fix something, but it definitely helps the search engines indexing the Joomla pages which use protostar (probably not many production sites do use it).
A better explanation why it could make sense to wrap the whole page inside a WebPage
http://webmasters.stackexchange.com/questions/52570/linking-several-separated-microdata-divs-together/52592#52592
You can have the Event as a standalone scope. It doesn't need to be tied to a root element at all. So just remove the itemprop but leave the scope and type in. Then it's valid.
The itemprop would require the parent type to be one of
A better explanation why it could make sense to wrap the whole page inside a WebPage
http://webmasters.stackexchange.com/questions/52570/linking-several-separated-microdata-divs-together/52592#52592
Actually, that link says the same as I do. Wrapping it into a "WebPage" type is invalid:
If a parent element specifies another item (e.g., a WebPage on the body), the above solution does not work because then the event property would also apply to the WebPage, which would not be correct.
You're welcome.
My head exploded a year ago when I read up on that stuff. I still can remember a bit of it though
Closing as it's resolved.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-06-19 08:57:37 |
Closed_By | ⇒ | Bakual |
I second @laoneo on this request. Please consider applying this patch.