Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I relate Job (jobTitle) to Organization (worksFor) in Schema.org markup?

Under a Person schema, I want to associate each job title with its respective organization. This is in a resume-like setting, so there are many jobs and many organizations.

Here's an actual example of some code from my project (content clipped + changed):

<div itemscope itemtype="http://schema.org/Person">
  …
  <p><!--list of jobs-->
    <span itemprop="jobTitle">Job 1</span>, 
    <span itemprop="jobTitle">Job 2</span>, and 
    <span itemprop="jobTitle">Job 3</span>
  </p>
  <p><!--list of places worked for-->
    <span itemprop="worksFor">Company A</span> and
    <span itemprop="worksFor">Company B</span>
  </p>
</div>

That returns a schema like this from https://search.google.com/structured-data/testing-tool/:

@type   Person
jobTitle    Job 1
jobTitle    Job 2
jobTitle    Job 3
worksFor    
    @type   Organization
    name    Company A
worksFor    
    @type   Organization
    name    Company B

Let's say I want Jobs 1 & 2 to be part of Company A and Job 3 to be with Company B. How would I express that so it has a clean hierarchy in the Schema?

I understand I have the option of itemref (from questions like How do I relate items in schema.org?) but I can't figure out how to engineer a way to make the jobTitle reference the Organization (worksFor).

like image 533
Steven Avatar asked Aug 24 '16 16:08

Steven


People also ask

What is job Schema?

A listing that describes a job opening in a certain organization. Property. Expected Type. Description. Properties from JobPosting.

Can schema org definitions be used in email messages as well as Web pages?

But aside from webpages, you can also add Schema.org markup to emails, and use it to create Rich Pins on Pinterest for increased engagement. Schema.org for emails is a Google initiative, and so far the functionality is only available to Gmail accounts.

What is a schema org type?

Schema.org is defined as two hierarchies: one for textual property values, and one for the things that they describe. This is the main schema.org hierarchy: a collection of types (or "classes"), each of which has one or more parent types.

What is the use of schema org?

Schema.org is simply a site where we document the schemas that several major search engines will support. Schema.org is a collaboration between Google, Microsoft, Yahoo! and Yandex - large search engines who will use this marked-up data from web pages. Other sites - not necessarily search engines - might later join.


2 Answers

I don't believe this can happen between Schema and how Google (or at least the Structured Data tool) interprets it. I could be wrong, but I think the problem is that both jobTitle and worksFor apply to person. So Google will relate both of those attributes to the person but not necessarily relate the two attributes to each other.

It could also be that I'm missing something in my approach and that this is actually possible. I wanted to post my answer to at least guide you or someone with better experience in the right direction (or confirm my suspicions). I have two approaches, I believe the Microdata approach appears right in the tool but is wrong. I think the JSON-LD approach is correct but does not display properly in the Structured Data tool.

Microdata approach

If you can modify the DOM to an extent, you could use meta tags to nest an organization within the person. Although the Structured data tool shows results as I think you would want, I'm not convinced the data would really be related because the employee isn't really attached to the id:

<div itemscope itemtype="http://schema.org/Person" id="person1">
  <p><!--list of jobs-->
    <span>Job 1</span>, 
    <span>Job 2</span>, and 
    <span>Job 3</span>
  </p>
  <p><!--list of places worked for-->
    <span itemscope itemprop="worksFor" itemtype="http://schema.org/Organization">
        <span itemprop="name">Company A</span>
        <span itemscope itemprop="employee" itemref="person1" itemtype="http://schema.org/Person">
            <meta itemprop="jobTitle" content="Job 1">
        </span>
    </span> and
    <span itemscope itemprop="worksFor" itemtype="http://schema.org/Organization">
        <span itemprop="name">Company B</span>
        <span itemscope itemprop="employee" itemref="person1" itemtype="http://schema.org/Person">
            <meta itemprop="jobTitle" content="Job 2">
            <meta itemprop="jobTitle" content="Job 3">
        </span>
    </span>
  </p>
</div>

Which returns:

@type = Person

worksFor    
    @type = Organization
    name = Company A

    employee    
        @type = Person
        jobTitle = Job 1

worksFor    
    @type = Organization
    name = Company B

    employee    
        @type = Person
        jobTitle = Job 2
        jobTitle = Job 3

I approached this by nesting Person > Organization > Employee (Person) > JobTitle. I added a blank span for employee with meta tags so you can maintain the same front end styles.

My concern with this approach is that the Employee under each Organization would be disconnected from the parent Person. I used an id on the parent and used itemref in each Employee to point to that parent id but I'm not sure if that is truly supported, or maybe it being nested is enough (doubtful).

JSON-LD Approach

I think the JSON-LD approach properly relates the person to the Organization, but Google's tool in the end will push the jobTitle back to the person basically giving you the same results. There might be a better way to relate the data though.

<script type="application/ld+json">
      {
        "@context": {
            "@vocab": "http://schema.org/",
            "id": "@id",
            "graph": "@graph",
            "type": "@type"
        },
        "graph" : [
            {
                "type": "Person",
                "id": "Person1",
                "name": "John Smith",
                "worksFor" : [
                    {
                        "id": "CompanyA"
                    }, 
                    {
                        "id": "CompanyB"
                    }
                ]
            }, 
            {
                "type": "Organization",
                "id": "CompanyA",
                "name": "Company A",
                "employees": [
                    {
                        "@id" : "Person1",
                        "jobTitle" : ["Job 1", "Job 2"]
                    }
                ]
            }, 
            {
                "type": "Organization",
                "id": "CompanyB",
                "name": "Company B",
                "employees": [
                    {
                        "@id" : "Person1",
                        "jobTitle" : "Job 3"
                    }
                ]
            }
        ]
      }
</script>

Which unfortunately returns:

@type : http://www.example.com/Person
@id : http://www.example.com/Person1
name : John Smith
jobTitle : Job 1
jobTitle : Job 2
jobTitle : Job 3

worksFor    
    @type : http://www.example.com/Organization
    @id : http://www.example.com/CompanyA
    name : Company A

worksFor    
    @type : http://www.example.com/Organization
    @id : http://www.example.com/CompanyB
    name : Company B

While the Structured Data tool presents one option above in a way that looks right and one that looks wrong but seems right, it's tough to say how Google is truly relating the data. It may also just be that Schema/Data tool assumes the relation at a more basic level, where normally someone won't have multiple job titles across multiple organizations.. but I'm just speculating at that point.

Bottom line is - I feel the problem is that Organization can only be listed under a person as worksFor. jobTitle can only be under a person and not under Organization. You can relate Person under an Organization as employee, but that seems to just push jobTitle back to the related person anonymously in the structured data tool. The Structured Data Tool has known to have some flaws against Google documentation in the past, so I'm not sure you can't rely 100% on what you see from it.

like image 165
Stu Furlong Avatar answered Sep 25 '22 21:09

Stu Furlong


After some struggling to link jobs to companies in my online resume, I implemented something looking like this.

For reference : schema.org OrganizationRole

<div itemscope itemtype="https://schema.org/Person">
  <div itemprop="worksFor" itemscope itemtype="https://schema.org/EmployeeRole">
    <div itemprop="worksFor" itemscope itemtype="https://schema.org/Corporation">
      <span itemprop="name">[COMPANY]</span>
    </div>
    <span itemprop="roleName">[JOB]</span>
  </div>
  <p itemprop="name">[NAME]</p>
</div>

You can test your microdata here (google Structured Data Testing Tool)

like image 38
Max Press Avatar answered Sep 23 '22 21:09

Max Press