Browse Source

post: Improve Microdata metadata (#407)

zaazi 7 years ago
parent
commit
f72cced47c
2 changed files with 7 additions and 4 deletions
  1. 4 1
      layouts/partials/article_metadata.html
  2. 3 3
      layouts/partials/post_li.html

+ 4 - 1
layouts/partials/article_metadata.html

@@ -6,10 +6,13 @@
     {{ if ne $.Params.Lastmod $.Params.Date }}
         {{ i18n "last_updated" }}
     {{ end }}
-    <time datetime="{{ $.Date }}" itemprop="datePublished">
+    <time datetime="{{ $.Date }}" itemprop="datePublished dateModified">
       {{ $.Lastmod.Format $.Site.Params.date_format }}
     </time>
   </span>
+  <span itemscope itemprop="author publisher" itemtype="http://schema.org/Person">
+    <meta itemprop="name" content="{{ $.Site.Params.name }}">
+  </span>
 
   {{ if ne $.Site.Params.reading_time false }}
   <span class="middot-divider"></span>

+ 3 - 3
layouts/partials/post_li.html

@@ -1,13 +1,13 @@
 {{ $post := .post }}
 
-<div class="article-list-item" itemscope itemprop="blogPost">
+<div class="article-list-item" itemscope itemprop="blogPost" itemtype="http://schema.org/BlogPosting">
   {{ $preview := $post.Params.header.preview | default true }}
   {{ if and $post.Params.header.image $preview }}
   <a href="{{ $post.Permalink }}">
     <img src="{{ "/img/" | relURL }}{{ $post.Params.header.image }}" class="article-banner" itemprop="image">
   </a>
   {{end}}
-  <h3 class="article-title" itemprop="name">
+  <h3 class="article-title" itemprop="headline">
     <a href="{{ $post.Permalink }}" itemprop="url">{{ $post.Title }}</a>
   </h3>
   {{ partial "article_metadata" (dict "content" $post "is_list" 1) }}
@@ -20,7 +20,7 @@
     {{ $post.Content }}
     {{ end }}
   </div>
-  <p class="read-more">
+  <p class="read-more" itemprop="mainEntityOfPage">
     <a href="{{ $post.Permalink }}" class="btn btn-primary btn-outline">
       {{ i18n "continue_reading" }}
     </a>