Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Microdata semantic-extend


Published on

Published in: Technology, Design
  • Be the first to comment

Microdata semantic-extend

  1. 1. MicrodataExtending Semantics jacobtan@2011-11
  2. 2. SemanticsWhy?• Clean - read / edit / reuse• More accessible - devices• Search engine friendly - content / code / understandWhat?• Text-Level Semantics Elements - a / em / strong (inline)• Structural Semantic Elements - p / h1… / article / header (block)• Interactive Semantics - detail / summary / command / menuSemantics web• data’s common formats and integration• the data relates to real world objects
  3. 3. Extending SemanticsWhy? - Limited Html labels and attributes/infinite objects of the world• Mark up a Object? person/event/review/product/movie <person> <name>your name<name></person>• Web’s Data? for script / machines <div yourData=“data for machine”>visible content</div>
  4. 4. Extending Semantics• custom data attributeData-* private for your page or app<div data-name-alice="fake name">your name</div>elementNode.dataset.nameAlice(); (firefox/chrome/safari/opera)• WAI-ARIA?
  5. 5. Extending SemanticsMark up a Object : person/movie /product …public for your page or app and other machines• Microformats• RDFa• Microdata• …
  6. 6. Microformats<div class="vcard"> My name is <span class="fn">Bob Smith</span>, Here is my home page: <a href="" class="url"></a>.</div>CalssDesigned for humans first and machines second, data formats APIdocument.getElementsByClassName("className")document.querySelectorAll(".className")
  7. 7. RDFa<div xmlns:v="" typeof="v:Person"> My name is <span property="v:name">Bob Smith</span>, Here is my homepage: <a href="" rel="v:url"></a>.</div>Bridging the Human and Data Websa set of XHTML attributes to augment visual data with machine-readable hints & propertyDom APIdocument.getItemsByType("");document.getItemByProperty("foaf:name", "Albert Einstein");
  8. 8. RDFa Lite<p vocab="" typeof="Person"> My name is<span property="name">Manu Sporny</span> and you can give me a ring via<span property="telephone">1-800-555- 0155</span>. <img rel="image" src="" /></p>schema
  9. 9. Microdata<div itemscope itemtype=""> My name is <span itemprop="name">Bob Smith</span>, Here is my homepage: <a href="" itemprop="url"></a>.</div>allows machine-readable data to be embedded in HTML documentsin an easy-to-write manner
  10. 10. Choose your way• Easy?• Bonus?• Forward?• Standard?
  11. 11. Microdata • Easy (simplicity & extensibility) • HTML5 (forward & standard) • (search engine bonus)
  12. 12. Microdata & Schema<div itemscope itemtype=""> My name is <span itemprop="name">Bob Smith</span> Here is my homepage: <a href="" itemprop="url"></a>.</div>Itemscope 声明数据Itemtype 指定数据类型 ....Itemprop 指定数据某个属性DOM API document.getItems("") opera11.60+详细文档
  13. 13. 统一词汇库
  14. 14. VS<meta itemprop="priceCurrency" content="CNY" /><div itemscope itemtype=""> <div itemprop="breadcrumb"> <a href="#">数码家电</a> > <a href="#">手机</a> > <a href="#">Htc</a> </div></div><meta itemprop="currency" content="CNY" /><div itemscope itemtype=""> <a href="#" itemprop="url"><span itemprop="title">数码家电</span></a></div><div itemscope itemtype=""> <a href="#" itemprop="url"><span itemprop="title">手机</span></a></div>
  15. 15. Google富网摘( Rich snippets)• Microformats• RDFa• Microdata
  16. 16. Rich Snippets Testing Tool<div itemscope itemtype=""> <span itemprop="name">Kenmore White 17" Microwave</span> <img src="kenmore-microwave-17in.jpg" alt=Kenmore 17" Microwave /> <div itemprop="aggregateRating" itemscope itemtype=""> Rated <span itemprop="ratingValue">3.5</span>/5 based on <span itemprop="reviewCount">11</span> customer reviews </div> <div itemprop="offers" itemscope itemtype=""> <span itemprop="price">$55.00</span> <link itemprop="availability" href="" />In stock </div> Product description: <span itemprop="description">0.7 cubic feet countertop microwave. Has six preset cooking categories and convenience features like Add-A-Minute and Child Lock.</span></div>
  17. 17. THX Q&A