2013-06-23 30 views
1

我試圖用微數據清楚地向Google解釋我們的小電影俱樂部。我在schema.org上來回穿梭,並建立了我需要的三大類:電影,電影劇場和事件。如何使用微數據標記電影列表?

但是,似乎我需要佈置代碼的方式是違反直覺的。

對於我來說,PLACE(MovieTheater)將舉辦一個活動,他們將展示一部MOVIE,這似乎是合乎邏輯的。

但似乎這是不可能的,因爲沒有辦法將MOVIE放入EVENT中。

似乎我可以將這些東西列爲單個實體的唯一方法是將MOVIE放在最外面,包含發生在MOVIETHEATER處的EVENT。但是,如果我想列出多個MOVIE,則必須重複MOVIE對象下的所有MOVIETHEATER數據,導致大量不必要的HTML。

那麼,我看錯了還是錯過了一些東西;或者是唯一的辦法嗎?

回答

1

看來你是對的。 使用microdata'sitemref爲了不重複MovieTheater描述。就像例如

In this example, a single license statement is applied to two works, using itemref from the items representing the works: 

<!DOCTYPE HTML> 
<html> 
<head> 
    <title>Photo gallery</title> 
</head> 
<body> 
    <h1>My photos</h1> 
    <figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"> 
    <img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest."> 
    <figcaption itemprop="title">The house I found.</figcaption> 
    </figure> 
    <figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses"> 
    <img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside."> 
    <figcaption itemprop="title">The mailbox.</figcaption> 
    </figure> 
    <footer> 
    <p id="licenses">All images licensed under the <a itemprop="license" 
    href="http://www.opensource.org/licenses/mit-license.php">MIT 
    license</a>.</p> 
    </footer> 
</body> 
</html> 

順便說一句,你可以在[email protected]

+0

感謝喜寫有關schema.org的意見和建議。我後來偶然發現了一些提及itemref的問題和答案,但schema.org網站上根本沒有關於itemref的內容。 – ThisLeeNoble

+0

由於schema.org未描述微數據標準,因此它描述了可以與微數據標準一起使用的元數據。查看[HTML5微數據](http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#attr-itemref)規範 –