如何使用HTML 5创建在线精美简历

开发 前端
本节教您使用HTML 5和Schema.org微数据创建了一个精美的在线简历,可以在搜索引擎结果里提供你的相关信息。此外,通过使用作者署名标记,你可以帮助搜索引擎识别网络上所有你自己的原创内容!

教程细节

◆  概要:HTML5的微数据API

◆  难度:初级/中级

◆  估计完成时间: 60-90分钟

将创建的最终产品

 

 

下载源文件 示例页面

2009年5月,谷歌推出了富摘要信息,在Google的搜索结果显示一个小块,使用户更容易决定哪些网页是他们搜索相关的信息。在2011年6月,谷歌宣布建立Schema.org,从谷歌、Bing和雅虎创建结构化数据的标记模式。

本教程演示了如何采用Schema.org的微数据创建一个在线的简历。本教程还包括关于如何使用作者署名标记!(译者注:Schema.org相关信息可参见http://www.rwwchina.com/2011/06/is_schemaorg_really_a_google_land_grab.html)

附加内容包括

本教程示例是一个页面的网站模板,你可以自由的作为你的网上简历使用。作为多余的奖励,多种颜色版本都包含在源文件的zip包中:深绿色,浅绿色,深蓝色和浅蓝色。

请注意,这并不是网页设计或CSS教程,所以只会提到HTML5和Schema.org的微数据标记。

现在,让我们开始吧!

第1步:CSS

创建一个名为“style.css”的CSS样式表,包括下面的代码。不要担心,这相当简单,并且理解它不是本教程的必须。

  1. /* Default Styles  
  2. --------------------------------------------------- */  
  3.  
  4. body {  
  5.     margin: 0px;  
  6.     padding: 0px;  
  7.     background: url("../images/bg_dark_green.png");  
  8.     background-color: inherit;  
  9.     font-size: 16px;  
  10.     font-family: "Trebuchet MS", Helvetica, sans-serif;  
  11.     color: #000;  
  12. }  
  13.  
  14. a:link {  
  15.     text-decoration: underline;  
  16.     color: #000;  
  17.     font-weight: bold;  
  18. }  
  19.  
  20. a:visited {  
  21.     text-decoration: underline;  
  22.     color: #000;  
  23.     font-weight: bold;  
  24. }  
  25.  
  26. a:hover {  
  27.     text-decoration: underline;  
  28.     color: #669933;  
  29.     font-weight: bold;  
  30. }  
  31.  
  32. a:active {  
  33.     text-decoration: underline;  
  34.     color: #000;  
  35.     font-weight: bold;  
  36. }  
  37.  
  38. #wrapper    {  
  39.     width: 965px;  
  40.     margin: 0 auto;  
  41. }  
  42.  
  43. #content {  
  44.     background-color: #eee;  
  45.     width: 960px;  
  46.     text-align: left;  
  47.     overflow: auto;  
  48.     position: relative;  
  49.     margin: 25px 0px 25px 0px;  
  50.     border: #fff solid 2px;  
  51. }  
  52.  
  53. .clear  {  
  54.     float: none;  
  55.     clear: both;  
  56.     margin: 20px 0px 20px 0px;  
  57. }  
  58.  
  59. /* Header  
  60. --------------------------------------------------- */  
  61.  
  62. #contact-details .header_1 {  
  63.     float: left;  
  64.     width: 350px;  
  65.     text-align: center;  
  66.     margin: 40px 0px 0px 20px;  
  67. }  
  68.  
  69. #contact-details .header_1 img {  
  70.     border: #fff solid 4px;  
  71.     background: url("../images/bg_img_dark_green.png");  
  72.     padding: 16px;  
  73.     margin: 10px 0px 0px 0px;  
  74. }  
  75.  
  76. #contact-details .header_2 {  
  77.     float: left;  
  78.     width: 570px;  
  79.     margin: 40px 0px 0px 10px;  
  80. }  
  81.  
  82. #contact-details .header_2 a {  
  83.     font-weight: normal;  
  84. }  
  85.  
  86. #contact-details  h1    {  
  87.     margin: 0px 0px 0px 20px;  
  88.     font-size: 52px;  
  89.     font-weight: bold;  
  90. }  
  91.  
  92. #contact-details  h3    {  
  93.     margin: 0px 0px 32px 20px;  
  94.     font-size: 30px;  
  95.     font-weight: bold;  
  96.     font-style: italic;  
  97. }  
  98.  
  99. #contact-details ul.info_1  {  
  100.     list-style: none;  
  101.     margin: 0px 0px 0px -12px;  
  102.     font-size: 18px;  
  103. }  
  104.  
  105. #contact-details ul.info_2  {  
  106.     list-style: none;  
  107.     margin: 0px 0px 15px -12px;  
  108.     font-size: 18px;  
  109. }  
  110.  
  111. #contact-details li.address {  
  112.     background: url("../images/home.png") no-repeat;  
  113.     background-position: 0px 0px;  
  114.     padding: 0px 0px 12px 40px;  
  115. }  
  116.  
  117. #contact-details li.phone   {  
  118.     background: url("../images/phone.png") no-repeat;  
  119.     background-position: 0px 0px;  
  120.     padding: 0px 0px 12px 40px;  
  121. }  
  122.  
  123. #contact-details li.email   {  
  124.     background: url("../images/mail.png") no-repeat;  
  125.     background-position: 0px 0px;  
  126.     padding: 0px 0px 12px 40px;  
  127. }  
  128.  
  129. #contact-details li.site_url    {  
  130.     background: url("../images/computer.png") no-repeat;  
  131.     background-position: 0px 2px;  
  132.     padding: 0px 0px 12px 40px;  
  133. }  
  134.  
  135. #contact-details li.twitter {  
  136.     background: url("../images/twitter_sm.png") no-repeat;  
  137.     background-position: 0px 0px;  
  138.     padding: 0px 0px 12px 40px;  
  139. }  
  140.  
  141. /* Main Content  
  142. --------------------------------------------------- */  
  143.  
  144. h2.top  {  
  145.     margin: 0px;  
  146.     font-size: 22px;  
  147.     font-weight: bold;  
  148. }  
  149.  
  150. h2  {  
  151.     margin: 40px 0px 0px 0px;  
  152.     font-size: 22px;  
  153.     font-weight: bold;  
  154. }  
  155.  
  156. dl  {  
  157.     margin: 0px 50px 0px 0px;  
  158. }  
  159.  
  160. dt  {  
  161.     float: left;  
  162.     width: 200px;  
  163.     font-size: 20px;  
  164.     font-weight: bold;  
  165.     font-style: italic;  
  166.     text-align: right;  
  167. }  
  168.  
  169. dd  {  
  170.     width: 620px;  
  171.     float: right;  
  172.     margin-right: 20px;  
  173. }  
  174.  
  175. dl#contact  {  
  176.     margin: 0px;  
  177. }  
  178.  
  179. dt#contact  {  
  180.     margin: 0px;  
  181. }  
  182.  
  183. dd#contact  {  
  184.     margin: 0px;  
  185. }  
  186.  
  187. p.bus1  {  
  188.     margin: 0px;  
  189.     font-weight: bold;  
  190.     color: #669933;  
  191. }  
  192.  
  193. p.edu-info  {  
  194.     margin: 10px 0px 0px 0px;  
  195.     font-weight: bold;  
  196.     color: #669933;  
  197. }  
  198.  
  199. p.edu-info a    {  
  200.     color: #000;  
  201. }  
  202.  
  203. p.edu-info a:hover  {  
  204.     color: #669933;  
  205. }  
  206.  
  207. p.time  {  
  208.     margin: 0px;  
  209. }  
  210.  
  211. p.summary   {  
  212.     margin: 10px 0px 0px 0px;  
  213. }  
  214.  
  215. #skills ul.list1    {  
  216.     float: left;  
  217.     list-style: none;  
  218.     margin: 0px 0px 0px -40px;  
  219.     width: 220px;  
  220. }  
  221.  
  222. #skills ul.list2    {  
  223.     float: left;  
  224.     list-style: none;  
  225.     margin: 0px 0px 0px 0px;  
  226.     width: 220px;  
  227. }  
  228.  
  229. #skills li {  
  230.     background: url("../images/bullet_green.png") no-repeat;  
  231.     background-position: 0px 2px;  
  232.     padding: 0px 0px 0px 25px;  
  233. }  
  234.  
  235. abbr    {  
  236.     border-width: 0px;  
  237. }  
  238.  
  239. /* Footer  
  240. --------------------------------------------------- */  
  241.  
  242. #footer {  
  243.     margin: 60px 40px 0px 40px;  
  244. }  
  245.  
  246. #footer img {  
  247.     border: 0px;  
  248. }  
  249.  
  250. #footer .footer_content {  
  251.     width: 700px;  
  252.     overflow: auto;  
  253.     margin: auto;  
  254.     border: #fff solid 2px;  
  255.     background-color: #dcdcdc;  
  256. }  
  257.  
  258. #footer ul.icons_1  {  
  259.     float: left;  
  260.     width: 525px;  
  261.     margin: 15px 10px 10px 15px;  
  262.     padding: 0px;  
  263. }  
  264.  
  265. #footer ul.icons_2  {  
  266.     float: right;  
  267.     width: 100px;  
  268.     margin: 10px 20px 10px 10px;  
  269.     padding: 0px;  
  270. }  
  271.  
  272. #footer .icons_1 li, #footer .icons_2 li {  
  273.     margin: 0px 0px 0px 7px;  
  274.     padding: 0px;  
  275.     list-style-type: none;  
  276.     display: inline;  
  277. }  
  278.  
  279. #footer a   {  
  280.     color: #000;  
  281. }  
  282.  
  283. #footer a:hover {  
  284.     color: #669933;  
  285. }  
  286.  
  287. #footer .credits {  
  288.     float: none;  
  289.     clear: both;  
  290.     margin: 10px 0px 20px 0px;  
  291.     font-size: 12px;  
  292.     text-align: center;  
  293. }  
  294.  
  295. #footer .credits a  {  
  296.     font-weight: normal;  

#p#

第2步:页面

下一步,我们需要一个HTML文件。下面是一个我们都可能熟悉的基本布局。

  1. <!DOCTYPE html> 
  2. <html> 
  3. <head> 
  4. <meta charset=UTF-8"> 
  5. <meta charset="utf-8"> 
  6.    
  7. <title>Online Resume of Your Name</title> 
  8.    
  9. <!-- Meta --> 
  10. <meta name="description" content="A few lines about yourself"> 
  11. <meta name="keywords" content="web,developer,designer,resume" /> 
  12. <meta name="author" content="Your Name"> 
  13.    
  14. <!-- CSS Stylesheet --> 
  15. <link rel="stylesheet" type="text/css" href="css/style.css" /> 
  16.    
  17. <!--[if lt IE 9]> 
  18. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> 
  19. <![endif]--> 
  20.    
  21. </head> 
  22. <body> 
  23.    
  24. <!-- Begin Wrapper --> 
  25. <div id="wrapper"> 
  26.    
  27. <!-- Begin Content Area --> 
  28. <div id="content"> 
  29.    
  30. <!-- Begin Header --> 
  31. <header> 
  32.    
  33. <!-- Begin Contact Section --> 
  34. <section id="contact-details"> 
  35.    
  36. <!-- Begin Profile Image Section --> 
  37. <div class="header_1"> 
  38. <img src="images/profile.jpg" width="250" height="250" alt="Your Name" /> 
  39. </div> 
  40. <!-- End Profile Image Section --> 
  41.    
  42. <!-- Begin Profile Information Section --> 
  43. <div class="header_2"> 
  44.    
  45. <h1><span>Your Name</span></h1> 
  46. <h3>Web Developer / Designer</h3> 
  47.    
  48. <ul class="info_1"> 
  49. <li class="address">555 Street Address, Toledo, Ohio, 43606  U.S.A.</li> 
  50. </ul> 
  51.    
  52. <ul class="info_2"> 
  53. <li class="phone">(000) 000-0000</li> 
  54. <li class="email"><a href="mailto:your-email@gmail.com">your-email@gmail.com</a></li> 
  55. <li class="site_url"><a href="http://www.webcodepro.net/about.php" title="www.your-website.com">www.your-website.com</a></li> 
  56. <li class="twitter"><a href="http://twitter.com/twitter-screen-name" title="Follow Me on Twitter">@twitter-screen-name</a></li> 
  57. </ul> 
  58.    
  59. </div> 
  60. <!-- End Profile Information Section --> 
  61.    
  62. </section> 
  63. <!-- End Contact Section --> 
  64.    
  65. </header> 
  66. <!-- End Header --> 
  67.    
  68. <div class="clear"> </div> 
  69.    
  70. <!-- Begin Profile Section --> 
  71. <dl> 
  72. <dt>Profile:</dt> 
  73. <dd> 
  74.    
  75. <section class="summary"> 
  76. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.  
  77. </section> 
  78.    
  79. </dd> 
  80. </dl> 
  81. <!-- End Profile Section --> 
  82.    
  83. <div class="clear"> </div> 
  84.    
  85. <!-- Begin Skills Section --> 
  86.    
  87. <dl> 
  88. <dt>Skills:</dt> 
  89. <dd> 
  90.    
  91. <section id="skills"> 
  92. <ul class="list1"> 
  93. <li>XHTML</li> 
  94. <li>HTML5</li> 
  95. <li>PHP</li> 
  96. <li>JavaScript</li> 
  97. <li>Magento</li> 
  98. <li>WordPress</li> 
  99. </ul> 
  100. <ul class="list2"> 
  101. <li>HTML</li> 
  102. <li>CSS</li> 
  103. <li>MySQL</li> 
  104. <li>jQuery</li> 
  105. <li>CMS Made Simple</li> 
  106. <li>Photoshop</li> 
  107. </ul> 
  108. </section> 
  109.    
  110. </dd> 
  111. </dl> 
  112.    
  113. <!-- End Skills Section --> 
  114.    
  115. <div class="clear"> </div> 
  116.    
  117. <!-- Begin Experience Section --> 
  118. <dl> 
  119. <dt>Experience:</dt> 
  120.    
  121. <dd> 
  122.    
  123. <section id="experience"> 
  124.    
  125. <!-- Position #1 --> 
  126.    
  127. <h2 class="top">Web Developer / Designer</h2> 
  128. <p class="bus1">Company Name 1</p> 
  129. <p class="time">February 2009 - Present</p> 
  130.    
  131. <p> 
  132. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  133. </p> 
  134.    
  135. <!-- Position #2 --> 
  136.    
  137. <h2>Web Developer / Programmer</h2> 
  138. <p class="bus1">Company Name 2</p> 
  139. <p class="time">November 2007 - February 2009</p> 
  140.    
  141. <p> 
  142. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  143. </p> 
  144.    
  145. <!-- Position #3 --> 
  146.    
  147. <h2>Web Developer / Programmer</h2> 
  148. <p class="bus1">Company Name 3</p> 
  149. <p class="time">March 2006 - November 2007</p> 
  150.    
  151. <p> 
  152. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  153. </p> 
  154.    
  155. </section> 
  156.    
  157. </dd> 
  158. </dl> 
  159. <!-- End Experience Section --> 
  160.    
  161. <div class="clear"> </div> 
  162.    
  163. <!-- Begin Publications Section --> 
  164. <dl> 
  165. <dt>Publications:</dt> 
  166.    
  167. <dd> 
  168.    
  169. <section id="publications"> 
  170.    
  171. <a href="http://net.tutsplus.com/tutorials/php/how-to-create-an-advanced-twitter-widget/" target="_blank" title="How to Create an Advanced Twitter Widget">"How to Create an Advanced Twitter Widget"</a><a href="http://net.tutsplus.com/" target="_blank" title="Nettuts+">Nettuts+</a>, 8/25/11  
  172.    
  173. </section> 
  174.    
  175. </dd> 
  176. </dl> 
  177. <!-- End Publications Section --> 
  178.    
  179. <div class="clear"> </div> 
  180.    
  181. <!-- Begin Education Section --> 
  182. <dl> 
  183. <dt>Education:</dt> 
  184. <dd> 
  185.    
  186. <section id="education"> 
  187.    
  188. <p class="bus1">University of Toledo</p> 
  189.    
  190. 2801 Bancroft Street  
  191. <br /> 
  192. Toledo, Ohio, 43606  U.S.A.  
  193.    
  194. <p class="summary">Web Design</p> 
  195. <p class="time">2003 - 2005</p> 
  196.    
  197. <p class="edu-info"> 
  198. <a href="http://www.utoledo.edu/" target="_blank" title="University of Toledo">www.utoledo.edu</a> 
  199. </p> 
  200.    
  201. </section> 
  202.    
  203. </dd> 
  204. </dl> 
  205. <!-- End Education Section --> 
  206.    
  207. <div class="clear"> </div> 
  208.    
  209. <!-- Begin Footer --> 
  210. <footer id="footer"> 
  211.    
  212. <!-- Begin Footer Content --> 
  213. <div class="footer_content"> 
  214.    
  215. <!-- Begin Schema Person --> 
  216.    
  217. <ul class="icons_1"> 
  218. <li><a href="https://profiles.google.com/jwagner719" title="Google Profile"><img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32" alt="Google Profile"></a></li> 
  219. <li><a href="http://dribbble.com/" title="Dribbble"><img src="images/dribbble.png" width="32" height="32" alt="Dribbble" /></a></li> 
  220. <li><a href="http://www.linkedin.com/" title="LinkedIn"><img src="images/linkedin.png" width="32" height="32" alt="LinkedIn" /></a></li> 
  221. <li><a href="http://www.facebook.com/" title="Facebook"><img src="images/facebook.png" width="32" height="32" alt="Facebook" /></a></li> 
  222. <li><a href="http://www.flickr.com/" title="Flickr"><img src="images/flickr.png" width="32" height="32" alt="Flickr" /></a></li> 
  223. <li><a href="http://twitter.com/" title="Follow Me on Twitter!"><img src="images/twitter.png" width="32" height="32" alt="Follow Me on Twitter!" /></a></li> 
  224. </ul> 
  225.    
  226. <ul class="icons_2"> 
  227. <li><a href="resume.pdf" title="Download Resume PDF"><img src="images/download.png" width="48" height="48" alt="Download Resume PDF" /></a></li> 
  228. </ul> 
  229.    
  230. <!-- End Schema Person --> 
  231.    
  232. </div> 
  233. <!-- End Footer Content --> 
  234.    
  235. <div class="credits"> 
  236. Social Icons by <a href="http://paulrobertlloyd.com/2009/06/social_media_icons" target="_blank" title="Paul Robert Lloyd">Paul Robert Lloyd</a>, Profile & Download Icons by <a href="http://dryicons.com/" target="_blank" title="DryIcons">DryIcons</a>, Phone Icon by <a href="http://www.comfi.com/telecom-icons/" target="_blank" title="ComFi Telecom">ComFi Telecom</a>, Profile Image User Symbol by <a href="http://thenounproject.com/" target="_blank" title="The Noun Project">The Noun Project</a>.  
  237. <br /> 
  238. All used under a Creative Commons Attribution-ShareAlike license: <a href="http://creativecommons.org/licenses/by-sa/3.0/" target="_blank" title="Creative Commons Attribution-ShareAlike license">http://creativecommons.org/licenses/by-sa/3.0/</a> 
  239. </div> 
  240.    
  241. </footer> 
  242. <!-- End Footer --> 
  243.    
  244. </div> 
  245. <!-- End Content --> 
  246.    
  247. </div> 
  248. <!-- End Wrapper --> 
  249.    
  250. </body> 
  251. </html> 

#p#

关于页面的几个说明

HTML5 Shiv

由于Schema.org微数据是基于HTML5微数据的规范,HTML5的标记被用来创建一页简历的网站模板。不幸的是,旧的网页浏览器如IE7和IE8不承认某些HTML5元素。在这些旧的浏览器中,使用HTML5编写的页面将无法正确呈现。

当在IE8里点击图片查看全图时,下面是在线简历示例的截图:

 

 

为了解决这些旧IE浏览器版本的问题,在标签间添加了如下的代码(在CSS样式表下面):

  1. <!--[if lt IE 9]>    
  2. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>    
  3. <![endif]-->   

此代码是一个HTML5 JavaScript shim,用于让IE识别和渲染HTML5元素。

注:在IE9和其他现代浏览器中不需要使用HTML5 JavaScript shim。

定义列表

我们在标记中使用<dd></dd>而不是无序列表来定义列表。这是因为当考虑到每个项目都有一个标题和描述时更有意义。

Section vs Article

关于HTML5的Section和Article元素的使用似乎有一些混乱。我们在页面中使用Section元素,因为没有简历的段落是独立的内容。HTML5的Article元素被用在独立的内容上,例如博客文章或新闻报道。本文很好的解释了HTML5 Section和Acricle元素之间的差异 。

第三步:添加Schema.org微数据-Person和PostalAddress

我们首先要添加的模式类型是Person和PostalAddress。

Itemscope元素和ItemType属性

我们将一个itemscope元素添加到<div></div>标签上。

  1. <div itemscope itemtype="http://schema.org/Person"> 
  2.  Content that contains information about a Person  
  3.  </div> 

Itemscope元素和Person模式的ItemType 属性都将被放在简历页面联系方式和社会化媒体链接的部分,像如下所示:

  1. <!-- Begin Contact Section --> 
  2. <section id="contact-details"> 
  3. <div itemscope itemtype="http://schema.org/Person"> 
  4.    
  5. Rest of Code Block Here  
  6.    
  7. </div> 
  8. </section> 
  9. <!-- End Contact Section --> 
  1. <!-- Begin Social Media and Download Links --> 
  2. <div itemscope itemtype="http://schema.org/Person"> 
  3.    
  4. Rest of Code Block Here  
  5.    
  6. </div> 
  7. <!-- End Social Media and Download Links --> 

itemscope元素和PostalAddress模式的ItemType属性被嵌入Person模式中,包含地址信息放在无序的列表<ul></ul>中:

  1. <!-- Begin PostalAddress Schema --> 
  2. <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> 
  3. <ul class="info_1"> 
  4. <li class="address"><span itemprop="streetAddress">555 Street Address</span><span itemprop="addressLocality"<Toledo</span><span itemprop="addressRegion">Ohio</span><span itemprop="postalCode"<43606</span> <span itemprop="addressCountry">U.S.A.</span></li> 
  5. </ul> 
  6. </div> 
  7. <!-- End PostalAddress Schema --> 

Itemprop属性

需要把Itemprop属性添加到适当的span标记中,以便对搜索引擎提供我们网页的附加信息。下面是我们将使用这些模式的属性 :

Person模式

◆  itemprop="image"

◆  itemprop="name"

◆  itemprop="jobTitle"

◆  itemprop="telephone"

◆  itemprop="email"

◆  itemprop="url"

PostalAddress架构

◆   itemprop="streetAddress"

◆  itemprop="addressLocality"

◆   itemprop="addressRegion"

◆  itemprop="postalCode"

◆   itemprop="addressCountry"

联系人和社会化媒体链接段落的最终页面

  1. <!-- Begin Contact Section --> 
  2. <section id="contact-details"> 
  3. <div itemscope itemtype="http://schema.org/Person"> 
  4.    
  5. <!-- Begin Profile Image Section --> 
  6. <div class="header_1"> 
  7. <img src="images/profile.jpg" itemprop="image" width="250" height="250" alt="Your Name" /> 
  8. </div> 
  9. <!-- End Profile Image Section --> 
  10.    
  11. <!-- Begin Profile Information Section --> 
  12. <div class="header_2"> 
  13.    
  14. <h1><span itemprop="name">Your Name</span></h1> 
  15. <h3><span itemprop="jobTitle">Web Developer / Designer</span></h3> 
  16.    
  17. <!-- Begin PostalAddress Schema --> 
  18. <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> 
  19. <ul class="info_1"> 
  20. <li class="address"><span itemprop="streetAddress">555 Street Address</span><span itemprop="addressLocality"<Toledo</span><span itemprop="addressRegion">Ohio</span><span itemprop="postalCode"<43606</span> <span itemprop="addressCountry">U.S.A.</span></li> 
  21. </ul> 
  22. </div> 
  23. <!-- End PostalAddress Schema --> 
  24.    
  25. <ul class="info_2"> 
  26. <li class="phone"><span itemprop="telephone">(000) 000-0000</span></li> 
  27. <li class="email"><a href="mailto:your-email@gmail.com" itemprop="email">your-email@gmail.com</a></li> 
  28. <li class="site_url"><a rel="me" itemprop="url" href="http://www.webcodepro.net/about.php" title="www.your-website.com">www.your-website.com</a></li> 
  29. <li class="twitter"><a rel="me" itemprop="url" href="http://twitter.com/twitter-screen-name" title="Follow Me on Twitter">@twitter-screen-name</a></li> 
  30. </ul> 
  31.    
  32. </div> 
  33. <!-- End Profile Information Section --> 
  34.    
  35. </div> 
  36. </section> 
  37. <!-- End Contact Section --> 

 

  1. <!-- Begin Social Media and Download Links --> 
  2. <div itemscope itemtype="http://schema.org/Person"> 
  3.    
  4. <ul class="icons_1"> 
  5. <li><a rel="author" itemprop="url" href="https://profiles.google.com/jwagner719" title="Google Profile"><img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32" alt="Google Profile"></a></li> 
  6. <li><a rel="me" itemprop="url" href="http://dribbble.com/" title="Dribbble"><img src="images/dribbble.png" width="32" height="32" alt="Dribbble" /></a></li> 
  7. <li><a rel="me" itemprop="url" href="http://www.linkedin.com/" title="LinkedIn"><img src="images/linkedin.png" width="32" height="32" alt="LinkedIn" /></a></li> 
  8. <li><a rel="me" itemprop="url" href="http://www.facebook.com/" title="Facebook"><img src="images/facebook.png" width="32" height="32" alt="Facebook" /></a></li> 
  9. <li><a rel="me" itemprop="url" href="http://www.flickr.com/" title="Flickr"><img src="images/flickr.png" width="32" height="32" alt="Flickr" /></a></li> 
  10. <li><a rel="me" itemprop="url" href="http://twitter.com/" title="Follow Me on Twitter!"><img src="images/twitter.png" width="32" height="32" alt="Follow Me on Twitter!" /></a></li> 
  11. </ul> 
  12.    
  13. <ul class="icons_2"> 
  14. <li><a href="resume.pdf" title="Download Resume PDF"><img src="images/download.png" width="48" height="48" alt="Download Resume PDF" /></a></li> 
  15. </ul> 
  16.    
  17. </div> 
  18. <!-- End Social Media and Download Links --> 

#p#

第4步:添加Schema.org微数据-ITEMLIST列表

 

 

接下来我们要添加的标记模式是 ITEMLIST。

Itemscope元素和ItemType属性

ITEMLIST模式的itemscope元素和ItemType属性将被像如下这样放置在技能段落:

  1. <!-- Begin Skills Section --> 
  2. <div itemscope itemtype="http://schema.org/ItemList"> 
  3.    
  4. Rest of Code Block Here  
  5.    
  6. </div> 
  7. <!-- End Skills Section --> 

Itemprop属性

在适当的<span></span>标记中添加“ itemprop “属性。下面是我们将在这个模式中使用的属性:

ITEMLIST模式

◆ itemprop =“itemListElement”

技能段落的最终页面

  1. <!-- Begin Skills Section --> 
  2. <div itemscope itemtype="http://schema.org/ItemList"> 
  3.    
  4. <dl> 
  5. <dt itemprop="name">Skills:</dt> 
  6. <dd> 
  7.    
  8. <section id="skills"> 
  9. <ul class="list1"> 
  10. <li itemprop="itemListElement">XHTML</li> 
  11. <li itemprop="itemListElement">HTML5</li> 
  12. <li itemprop="itemListElement">PHP</li> 
  13. <li itemprop="itemListElement">JavaScript</li> 
  14. <li itemprop="itemListElement">Magento</li> 
  15. <li itemprop="itemListElement">WordPress</li> 
  16. </ul> 
  17. <ul class="list2"> 
  18. <li itemprop="itemListElement">HTML</li> 
  19. <li itemprop="itemListElement">CSS</li> 
  20. <li itemprop="itemListElement">MySQL</li> 
  21. <li itemprop="itemListElement">jQuery</li> 
  22. <li itemprop="itemListElement">CMS Made Simple</li> 
  23. <li itemprop="itemListElement">Photoshop</li> 
  24. </ul> 
  25. </section> 
  26.    
  27. </dd> 
  28. </dl> 
  29.    
  30. </div> 
  31. <!-- End Skills Section --> 

步骤5:添加Schema.org微数据-组织

下一步,我们将添加Organization模式。

Itemscope元素和ItemType属性

Organization模式的itemscope元素和ItemType属性将会被放置在“Experience”段落里所列出的 “Position”元素里,如下所示:

  1. <!-- Position #1 --> 
  2. <div itemscope itemtype="http://schema.org/Organization"> 
  3.    
  4. Rest of Code Block Here  
  5.    
  6. </div> 
  7.    
  8. <!-- Position #2 --> 
  9. <div itemscope itemtype="http://schema.org/Organization"> 
  10.    
  11. Rest of Code Block Here  
  12.    
  13. </div> 
  14.    
  15. <!-- Position #3 --> 
  16. <div itemscope itemtype="http://schema.org/Organization"> 
  17.    
  18. Rest of Code Block Here  
  19.    
  20. </div> 

Itemprop属性

在适当的<span></span>标记中添加“ itemprop “属性。下面是我们将在这个模式中使用的属性:

Organization模式

◆  itemprop="jobTitle"

◆ itemprop="name"

◆  itemprop="description"

工作经历段落的最终页面

  1. <section id="experience"> 
  2.    
  3. <!-- Position #1 --> 
  4. <div itemscope itemtype="http://schema.org/Organization"> 
  5.    
  6. <h2 class="top"><span itemprop="jobTitle">Web Developer / Designer</span></h2> 
  7. <p class="bus1"><span itemprop="name">Company Name 1</span></p> 
  8. <p class="time">February 2009 - Present</p> 
  9.    
  10. <p itemprop="description"> 
  11. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  12. </p> 
  13.    
  14. </div> 
  15.    
  16. <!-- Position #2 --> 
  17. <div itemscope itemtype="http://schema.org/Organization"> 
  18.    
  19. <h2><span itemprop="jobTitle">Web Developer / Programmer</span></h2> 
  20. <p class="bus1"><span itemprop="name">Company Name 2</span></p> 
  21. <p class="time">November 2007 - February 2009</p> 
  22.    
  23. <p itemprop="description"> 
  24. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  25. </p> 
  26.    
  27. </div> 
  28.    
  29. <!-- Position #3 --> 
  30. <div itemscope itemtype="http://schema.org/Organization"> 
  31.    
  32. <h2><span itemprop="jobTitle">Web Developer / Programmer</span></h2> 
  33. <p class="bus1"><span itemprop="name">Company Name 3</span></p> 
  34. <p class="time">March 2006 - November 2007</p> 
  35.    
  36. <p itemprop="description"> 
  37. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.  
  38. </p> 
  39.    
  40. </div> 
  41.    
  42. </section> 

第六步:添加Schema.org微数据-Article

 

 

接下来,我们将把Article模式添加到页面。

Article的Itemscope元素和ItemType属性

Article模式的itemscope元素和ItemType属性将会被放置在“Publications”段落里所列出的 “Article”元素里,如下所示:

  1. <section id="publications"> 
  2. <div itemscope itemtype="http://schema.org/Article"> 
  3.    
  4. Rest of Code Block Here  
  5.    
  6. </div> 
  7. </section> 

Itemprop属性

在适当的标记中添加“ itemprop “属性。下面是我们将在这个模式中使用的属性:

Article模式

◆ itemprop="name"

◆ itemprop="url"

Publications段落的最终页面

  1. <section id="publications"> 
  2. <div itemscope itemtype="http://schema.org/Article"><span itemprop="name"> 
  3. <a itemprop="url" href="http://net.tutsplus.com/tutorials/php/how-to-create-an-advanced-twitter-widget/" target="_blank" title="How to Create an Advanced Twitter Widget">"How to Create an Advanced Twitter Widget"</a></span><a href="http://net.tutsplus.com/" target="_blank" title="Nettuts+">Nettuts+</a>, 8/25/11  
  4. </div> 
  5. </section> 

第7步:添加Schema.org微数据- EducationalOrganization和PostalAddress

 

 

下一步我们将把EducationalOrganization和PostalAddress模式添加到页面。

EducationalOrganization的Itemscope元素和ItemType属性

PostalAddress的Itemscope元素和ItemType属性

PostalAddress模式的itemscope元素和ItemType属性嵌套在EducationalOrganization模式里,将会被放置在“Education”段落包含地址信息的代码里,如下所示:

  1. <section id="education"> 
  2. <div itemscope itemtype="http://schema.org/EducationalOrganization"> 
  3.    
  4. Rest of Code Block Here  
  5.    
  6. </div> 
  7. </section> 

Itemprop属性

在适当的<span></span>标记中添加“ itemprop “属性。下面是我们将在这个模式中使用的属性:

EducationalOrganization模式

◆ itemprop="name"

◆ itemprop="url"

PostalAddress架构

◆  itemprop="streetAddress"

◆ itemprop="addressLocality"

◆  itemprop="addressRegion"

◆  itemprop="postalCode"

◆  itemprop="addressCountry"

Education段落的最终页面

  1. <section id="education"> 
  2. <div itemscope itemtype="http://schema.org/EducationalOrganization"> 
  3.    
  4. <p class="bus1"><span itemprop="name">University of Toledo</span></p> 
  5.    
  6. <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> 
  7. <span itemprop="streetAddress">2801 Bancroft Street</span> 
  8. <br /> 
  9. <span itemprop="addressLocality">Toledo</span><span itemprop="addressRegion">Ohio</span><span itemprop="postalCode">43606</span><span itemprop="addressCountry">U.S.A.</span> 
  10. </div> 
  11.    
  12. <p class="summary"><span itemprop="name">Web Design</span></p> 
  13. <p class="time">2003 - 2005</p> 
  14.    
  15. <p class="edu-info"> 
  16. <a itemprop="url" href="http://www.utoledo.edu/" target="_blank" title="University of Toledo">www.utoledo.edu</a> 
  17. </p> 
  18.    
  19. </div> 
  20. </section> 

#p#

关于作者署名标记

 

 

在谷歌搜索结果中用图像显示作者署名标记(John Resig)。

在2011年6月,谷歌开始支持“作者署名标记”。通过使用例如REL =“作者” 和 rel =“我”的标记,搜索引擎可以识别网络上同一作者创建的内容。使用作者署名标记,有多个作者的网站可以将所有的文章分别链接到不同作者所属的特定页面。

多作者的网站需要使用rel=”author”标签来将独立的文章链接到合适的作者页面。如果作者页面包含使用了rel =“me”标签的一个链接到作者“Google个人资料”的链接,作者信息就可能会出现在搜索结果中。

为了帮助用户发现高质量的内容,谷歌正在试验把作者信息显示在搜索引擎结果里。此功能正在逐步推出,并可能成为搜索引擎结果和排名里一个非常重要的部分。

REL标签

一个网页简历网站模版的联系人和社会化媒体链接段落包含链接到一个主网站和社会化媒体页面的URL。“REL”属性需要被添加到这些段落的链接上,使得作者署名标记得以实现。作者署名标记允许搜索引擎来识别网络上同一作者所创建的内容。

有两个作者署名标记相关的特定标签:

◆ rel="me"

◆ rel="author"

简历网站页面的大多数链接指向关于同一个人的站点。所以我们添加了rel =“me”的标签。添加rel =“author”标签用于谷歌个人资料链接。根据你在何处发表的在线简历,您可能需要为“Google个人资料”链接使用rel =“me”标签来代替。

第8步:创建一个谷歌个人资料

如果你想开始在网上通过使用作者署名标记标识你的原文,你首先需要创建一个“Google个人资料”。

如果你已经有一个谷歌个人资料页,那么你应该更新您的个人资料(添加自己的照片,关于自己的信息,职业等)。

您还需要确保有一个+1的选项卡显示在页面上。

“如果您的Google个人资料中包括一个良好的、明确的内容,它将会有资格作为缩略图出现在搜索结果里”。

第9步:链接网页到你的Google个人资料

要为一个网页发布著作权,你需要做两件事:

◆ 将该网页链接到你的“Google个人资料”

◆ 更新“Google个人资料”链接到你网站的主页。

您可以使用文本链接将内容链接到你的Google个人资料:

  1. <a href="[https://plus.google.com/your_profile]?rel=me">Google+</a> 

或使用“Google个人资料”按钮代码:

  1. <a rel="me" href="https://profiles.google.com/your_profile"> 
  2.   <img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32"> 
  3. </a> 

谷歌最近改变了作者署名标记的说明,这将会影响到rel = “me“和rel =”author“标签的使用。新的说明指明在文本和个人资料按钮链接上都要使用rel =“author“标签。然而,rel =“me”需要用来替代rel =“author”。如下面的截图所示。

 

 

“错误:作者个人资料页没有一个到Google个人资料的rel = me式链接“的截图

用John Resig为例:

• 在John Resig个人站点的关于页面,他使用rel =“me“链接到了Google个人资料。

• 在John Resig的Google+资料中,他链接到了个人站点的主页和关于页面。

第10步:完整的Google作者署名表(非常重要)

一旦您添加了Schema.org的微数据和完成步骤8和9,完善并提交谷歌作者署名申请表 。

直到谷歌作者署名表格完成并提交前,您的作者署名标记可能无法正常工作。

第11步:利用富摘要测试工具测试微数据标记

 

 

点击图片以查看完整的测试结果

您可以通过使用谷歌富摘要测试工具来检查你的网页,以确保谷歌在搜索结果里能正确解析,并显示你的微数据标记。此测试工具可以检查包括几个类型的结构化的数据标记,微观数据, 微格式 和 RDFa。

注:谷歌富摘要测试工具处于测试阶段,可能会有意料之外的结果。在结果的完整尺寸截图里包括一个错误:“警告:缺少必要的参数fn”。Schema.org不使用“fn”标签,但是微格式使用这个标签。这最有可能是一个故障。

全部完成!

您现在已经使用HTML5和Schema.org微数据创建了一个精美的在线简历,可以在搜索引擎结果里提供你的相关信息。此外,通过使用作者署名标记,你可以帮助搜索引擎识别网络上所有你自己的原创内容!

还有什么问题?在评论里告诉我们,并谢谢你的阅读!

译自:http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-an-html5-microdata-powered-resume/

译者:蒋宇捷(转载请标明出处http://blog.csdn.net/hfahe)

【编辑推荐】

  1. 10个超赞便利的HTML 5/CSS3框架推荐
  2. HTML 5新特性Canvas入门秘籍
  3. 使用HTML 5和Javascript设计绘图程序
  4. ***的HTML 5编码教程和参考手册分享
  5. 10个让你忘记Flash的HTML 5应用演示
责任编辑:陈贻新 来源: 蒋宇捷的专栏
相关推荐

2012-02-24 15:28:36

ibmdw

2011-06-21 09:46:46

2012-06-04 13:22:01

HTML5

2012-06-23 20:13:44

HTML5

2015-12-30 13:58:00

DockerGit开发环境

2009-07-14 14:43:27

2011-11-03 10:11:37

HTML 5

2022-02-22 08:20:04

React工具PDF 文件

2010-01-14 14:21:05

CentOS系统

2011-07-25 16:32:08

HTML 5

2012-06-08 14:32:13

HTML5

2012-04-25 14:06:45

HTML5

2009-07-06 00:01:51

HTML 5元素

2010-07-27 09:44:16

HTML 5

2013-01-18 10:59:44

IBMdW

2012-05-09 14:49:23

HTML5

2013-08-29 09:53:04

HTML5MongoDB位置感知

2013-07-08 09:45:50

html5

2009-07-14 09:18:00

2013-08-20 17:05:38

HTML5 BoileWeb App模块化
点赞
收藏

51CTO技术栈公众号