? Error

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
18 Jun 2015

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.

Test instructions:

  • Download the Free version of DPCalendar from https://joomla.digital-peak.com/download/dpcalendar
  • Install it on your test server (preferable accessible from the internet)
  • Create some events in the future in DPCalendar
  • Publish the DPCalendar upcoming module on all pages
  • Open a page on the front
  • Copy the url in the browser address bar to https://validator.w3.org and run the validation
  • Before the patch is applied tons of the above errors will be shown, after the patch none of the above error should be reported in the validator
avatar laoneo laoneo - open - 18 Jun 2015
avatar 0sh0
0sh0 - comment - 18 Jun 2015

I second @laoneo on this request. Please consider applying this patch.

avatar brianteeman
brianteeman - comment - 18 Jun 2015

@0sh0 With any patch it is not about voting for it but testing it. If you want to see this being applied then please follow the testing instruction and report your findings

avatar zero-24 zero-24 - change - 18 Jun 2015
Status New Pending
Easy No Yes
avatar zero-24 zero-24 - change - 18 Jun 2015
Category Front End
avatar zero-24 zero-24 - change - 18 Jun 2015
Category Front End Front End Templates (site)
avatar Bakual
Bakual - comment - 18 Jun 2015

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.

avatar laoneo
laoneo - comment - 19 Jun 2015

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>
avatar Bakual
Bakual - comment - 19 Jun 2015

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.

avatar Fedik
Fedik - comment - 19 Jun 2015

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 :wink:

avatar zero-24 zero-24 - change - 19 Jun 2015
Labels Added: ?
avatar laoneo
laoneo - comment - 19 Jun 2015

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).

avatar laoneo
laoneo - comment - 19 Jun 2015

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

avatar Bakual
Bakual - comment - 19 Jun 2015

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

  • InformAction
  • InviteAction
  • JoinAction
  • LeaveAction
  • Organization
  • Place
  • PlayAction
avatar Bakual
Bakual - comment - 19 Jun 2015

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.

avatar laoneo
laoneo - comment - 19 Jun 2015

Thanks for your solution @Bakual it indeed does work. Got a free tutorial about structured data :-).

avatar Bakual
Bakual - comment - 19 Jun 2015

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 :smile:

Closing as it's resolved.

avatar Bakual Bakual - change - 19 Jun 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-06-19 08:57:37
Closed_By Bakual
avatar Bakual Bakual - close - 19 Jun 2015

Add a Comment

Login with GitHub to post a comment