浏览代码

Add more schema tags (#157)

* about,contact: add more schema tags for contact related information.
   It adds schema tags for the e-mail, telephone, and address, when they
   are available. They are linked to the Person type.

* about: add the schema Organization type.
   This way we also tag the organization url not just its name.

* about: add a hidden url schema property to the person.
   It makes sure that the URL of the website is linked to the person.

* about: add the sameAs property for each social link.
Ronny Chevalier 8 年之前
父节点
当前提交
74041d65d1
共有 2 个文件被更改,包括 11 次插入9 次删除
  1. 7 5
      layouts/partials/widgets/about.html
  2. 4 4
      layouts/partials/widgets/contact.html

+ 7 - 5
layouts/partials/widgets/about.html

@@ -2,7 +2,7 @@
 {{ $page := .page }}
 
 <!-- About widget -->
-<div class="row" itemprop="author" itemscope itemtype="http://schema.org/Person">
+<div class="row" itemprop="author" itemscope itemtype="http://schema.org/Person" itemref="{{ if $.Site.Params.email }}person-email{{ end }}{{ if $.Site.Params.phone }} person-telephone{{ end }}{{ if $.Site.Params.address}} person-address{{ end }}">
   <div class="col-xs-12 col-md-4">
     <div id="profile">
 
@@ -16,19 +16,21 @@
         <h2 itemprop="name">{{ $.Site.Params.name }}</h2>
         <h3 itemprop="jobTitle">{{ $.Site.Params.role }}</h3>
         {{ if $.Site.Params.organization }}
-        <h3 itemprop="worksFor">
-          {{ with $.Site.Params.organization_url }}<a href="{{ . }}" target="_blank">{{ end }}
-          {{ $.Site.Params.organization }}
+        <h3 itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
+          {{ with $.Site.Params.organization_url }}<a href="{{ . }}" target="_blank" itemprop="url">{{ end }}
+            <span itemprop="name">{{ $.Site.Params.organization }}</span>
           {{ if $.Site.Params.organization_url }}</a>{{ end }}
         </h3>
         {{ end }}
       </div>
 
+      <link itemprop="url" href="{{ $.Site.BaseURL }}">
+
       <ul class="social-icon" aria-hidden="true">
         {{ range $.Site.Params.social }}
         {{ $pack := or .icon_pack "fa" }}
         <li>
-          <a href="{{ .link | safeURL }}" target="_blank">
+          <a itemprop="sameAs" href="{{ .link | safeURL }}" target="_blank">
             <i class="{{ $pack }} {{ $pack }}-{{ .icon }} big-icon"></i>
           </a>
         </li>

+ 4 - 4
layouts/partials/widgets/contact.html

@@ -11,12 +11,12 @@
   <div class="col-xs-12 col-md-8">
     {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
 
-    <ul class="fa-ul">
+    <ul class="fa-ul" itemscope>
 
       {{ with $.Site.Params.email }}
       <li>
         <i class="fa-li fa fa-envelope fa-2x" aria-hidden="true"></i>
-        <span>
+        <span id="person-email" itemprop="email">
         {{- if $autolink }}<a href="mailto:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}}
         </span>
       </li>
@@ -34,7 +34,7 @@
       {{ with $.Site.Params.phone }}
       <li>
         <i class="fa-li fa fa-phone fa-2x" aria-hidden="true"></i>
-        <span>
+        <span id="person-telephone" itemprop="telephone">
         {{- if $autolink }}<a href="tel:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}}
         </span>
       </li>
@@ -61,7 +61,7 @@
       {{ with $.Site.Params.address }}
       <li>
         <i class="fa-li fa fa-map-marker fa-2x" aria-hidden="true"></i>
-        <span>{{ . }}</span>
+        <span id="person-address" itemprop="address">{{ . }}</span>
       </li>
       {{ end }}