13

ある男性が就職するという簡単な HTML ページがあるとします。

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <title>New Job for John Doe</title>
    </head>
    <body>
        <h1>New Job for John Doe</h1>
        <p>This week John Doe accepted an offer to become a Software Engineer at MITRE.  John graduated from MIT in 2005 with a BS in Computer Science.  He previously worked at a small company near Boston.  Blah, blah, blah.</p>
        <p>The MITRE Corporation is a not-for-profit organization chartered to work in the public interest.  The MITRE Corporation has two principal locations: Bedford, Massachusetts, and McLean, Virginia.  Blah, blah, blah.</p>
    </body>
</html>

schema.org 語彙を使用してセマンティック データを追加すると、次のようになります。

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <title>New Job for John Doe</title>
    </head>
    <body>
        <h1>New Job for John Doe</h1>
        <p itemscope itemtype="http://schema.org/Person">This week John Doe accepted an offer to become a <span itemprop="jobTitle">Software Engineer</span> at <span itemprop="worksFor">MITRE</span>.  John graduated from <span itemprop="alumniOf">MIT</span> in 2005 with a BS in Computer Science.  He previously worked at a small company near Boston.  Blah, blah, blah.</p>
        <p itemscope itemtype="http://schema.org/Corporation">The MITRE Corporation is a not-for-profit organization chartered to work in the public interest.  The MITRE Corporation has two principal locations: <span itemprop="location">Bedford, Massachusetts</span>, and <span itemprop="location">McLean, Virginia</span>.  Blah, blah, blah.</p>
    </body>
</html>

最初のパラグラフは明らかに John Doe という人物に関するもので、2 番目のパラグラフは The MITRE Corporation という会社に関するものです。しかし、最初の段落の「MITRE」は、2 番目の段落の「The MITRE Corporation」と同じです。schema.org を使用して、これらが同一であることを明示的に宣言するにはどうすればよいですか?

4

2 に答える 2

4

//更新:Schema.orgはpersoスキーマの仕様を拡張しました

明らかに人は会社に関係しているので、あなたができることは「人」のitemprop「所属」で人と組織の関係を作ることです。私がしたことはitemscope itemtype="Person"で段落をラップして展開することですitemprop"affiliation"とitemscopeitemtype= "Organization"を追加してスキーマパーソンを追加すると、セマンティックリレーションが作成され、パーソンは組織にアフィリエイトされます。また、「Person」の仕様を満たす必要があるため、itemprop="name"を使用してメタタグを追加しました

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>New Job for John Doe</title>
</head>
<body>
<div itemscope itemtype="http://schema.org/Person">
    <h1>New Job for John Doe</h1>
<meta itemprop="name" content="John Doe" />
    <p>This week John Doe accepted an offer to become a <span itemprop="jobTitle">Software Engineer</span> at <span itemprop="worksFor">MITRE</span>.  John graduated from <span itemprop="alumniOf">MIT</span> in 2005 with a BS in Computer Science.  He previously worked at a small company near Boston.  Blah, blah, blah.</p>
    <p itemprop="affiliation" itemscope itemtype="http://schema.org/Organization">The MITRE Corporation is a not-for-profit organization chartered to work in the public interest.  The MITRE Corporation has two principal locations: <span itemprop="location">Bedford, Massachusetts</span>, and <span itemprop="location">McLean, Virginia</span>.  Blah, blah, blah.</p>
</div> <!-- closing Schema "Person" -->
</body>
</html>

あなたはこれをグーグルリッチスニペットテストツールに入れることができます、そして私は出力があなたが探しているものであると思います

Item 
type:   http://schema.org/person
property:   
name:   John Doe
jobtitle:   Software Engineer
worksfor:   MITRE
alumniof:   MIT
affiliation: Item 1


Item 1
type:   http://schema.org/organization
property:   
location:   Bedford, Massachusetts
location:   McLean, Virginia
于 2013-01-14T12:13:03.647 に答える
1

私自身の質問に答える最初の試みは、次のように itemref 属性を使用することでした。

<p itemscope itemtype="http://schema.org/Person">
    This week John Doe accepted an offer to become a
    <span itemprop="jobTitle">Software Engineer</span>
    at <span itemprop="worksFor" itemref="TheMitreCorporation">MITRE</span>.
    John graduated from <span itemprop="alumniOf">MIT</span>
    in 2005 with a BS in Computer Science.
    He previously worked at a small company near Boston.  Blah, blah, blah.
</p>

<p itemscope itemtype="http://schema.org/Corporation" id="TheMitreCorporation">
    The MITRE Corporation is a not-for-profit organization chartered to work in the public interest.
    The MITRE Corporation has two principal locations:
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
        <span itemprop="name">Bedford, Massachusetts</span>
    </span>, and
    <span itemprop="location" itemscope itemtype="http://schema.org/Place">
        <span itemprop="name">McLean, Virginia</span>
    </span>. Blah, blah, blah.
</p>

しかし、一部のコメンターは、これはこの属性の正しい使用法ではないと正しく指摘しました。

だからここに私の 2 番目の試みがあります:itemid代わりに属性を使用します。会社名の両方のインスタンスにitemscopeanditemtype属性が与えられ、どちらも同じitemid値 (URL) に設定されます。

仕様には次のように書かれています:属性が指定されている要素に... itemscope 属性と itemtype 属性の両方が指定されていない要素に itemid 属性を指定してはなりません。」

<p itemscope itemtype="http://schema.org/Person">This week John Doe accepted an offer to become a <span itemprop="jobTitle">Software Engineer</span> at <span itemprop="worksFor" itemscope itemtype="http://schema.org/Corporation" itemid="http://www.mitre.org">MITRE</span>.  John graduated from <span itemprop="alumniOf">MIT</span> in 2005 with a BS in Computer Science.  He previously worked at a small company near Boston.  Blah, blah, blah.</p>
<p itemscope itemtype="http://schema.org/Corporation" itemid="http://www.mitre.org">The MITRE Corporation is a not-for-profit organization chartered to work in the public interest.  The MITRE Corporation has two principal locations: <span itemprop="location" itemscope itemtype="http://schema.org/Place"><span itemprop="name">Bedford, Massachusetts</span></span>, and <span itemprop="location" itemscope itemtype="http://schema.org/Place"><span itemprop="name">McLean, Virginia</span></span>.  Blah, blah, blah.</p>
于 2011-10-14T15:30:31.303 に答える