Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
406 views
in Technique[技术] by (71.8m points)

html - extending html5 microdata event schema

Have been adding html5 microdata to my online resume, and read in http://www.schema.org/docs/extension.html that you can extend existing schema.

I've been trying to extend Event to describe a Job with the following markup:

        <div class="job" itemscope itemtype="http://schema.org/Event/Job">
            <h2 itemprop="name">Web Developer</h2>
            <div itemprop="organizer" itemscope itemtype="http://schema.org/Organization">
                <span itemprop="name">Company Name 2</span>
                <span itemprop="location">London</span>
            </div>
            <span itemprop="startDate">January 2000</span>
            <span itemprop="endDate">February 2009</span>
            <p itemprop="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit...</p>
        </div>

When i use the Google Structured Data Testing Tool it gives the following errors:

        Item
            type:   http://schema.org/event/job
            property:
              name:         Web Developer
              organizer:    Item 4
              start date:   January 2000
              enddate:      February 2009
              description:  Lorem ipsum dolor sit amet, consectetuer adipiscing elit...
        Error: Page contains property "name" which is not part of the schema.
        Error: Page contains property "organizer" which is not part of the schema.
        Error: Page contains property "startdate" which is not part of the schema.
        Error: Page contains property "enddate" which is not part of the schema.
        Error: Page contains property "description" which is not part of the schema.
        Error: Missing required field "dtstart".
        Error: Missing required field "name".

Any ideas what's wrong? and how it should be done?

Many thanks,!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Google’s tool is wrong about the errors, probably because they don’t handle the case of Schema.org extensions (which is a valid use of the vocabulary).

But note that this extension mechanism is considered "outdated" anyway, see docs/extension.html is out of date, should be marked as such or fixed. It’s intended to display this message on the extension page soon:

Historical ("Slash-based") Extension Mechanism (2011-2013)

Status Note: We preserve this text to document our original approach to extensibility. We do not currently advocate the use of '/'-based extended names, although it should be harmless to use these. Other mechanisms including RDFa, JSON-LD, the Role type and additionalType property can now also be used for different extension scenarios.

[…]

(By the way, your values of startDate and endDate are not valid: you need to use the ISO 8601 date format.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...