Эх сурвалжийг харах

refactor: strip out Microdata for blog posts, pages, and pubs

Forms part of the transition from Microdata to JSON-LD.

See #413
George Cushen 5 жил өмнө
parent
commit
6cebeae654

+ 2 - 2
layouts/_default/single.html

@@ -1,12 +1,12 @@
 {{- define "main" -}}
 
-<article class="article" itemscope itemtype="http://schema.org/Article">
+<article class="article">
 
   {{ partial "page_header" . }}
 
   <div class="article-container">
 
-    <div class="article-style" itemprop="articleBody">
+    <div class="article-style">
       {{ .Content }}
     </div>
 

+ 4 - 4
layouts/partials/jsonld/article.html

@@ -2,10 +2,10 @@
 {{ $summary := .summary }}
 {{ $featured_image := ($page.Resources.ByType "image").GetMatch "*featured*" }}
 
-{{/* Get microdata type. */}}
-{{ $microdata_type := "Article" }}
+{{/* Get schema type. */}}
+{{ $schema := "Article" }}
 {{ if eq $page.Type "post" }}
-  {{ $microdata_type = "BlogPosting" }}
+  {{ $schema = "BlogPosting" }}
 {{ end }}
 
 {{/* Get author name. */}}
@@ -25,7 +25,7 @@
 <script type="application/ld+json">
   {
     "@context": "https://schema.org",
-    "@type": "BlogPosting",
+    "@type": {{$schema}},
     "mainEntityOfPage": {
       "@type": "WebPage",
       "@id": {{$page.Permalink}}

+ 4 - 4
layouts/partials/page_header.html

@@ -19,9 +19,9 @@
 <div class="article-header">
   {{ $img_src := urls.Parse .Params.header.image }}
   {{ if $img_src.Scheme }}
-  <img src="{{ .Params.header.image }}" class="article-banner" itemprop="image" alt="">
+  <img src="{{ .Params.header.image }}" class="article-banner" alt="">
   {{ else }}
-  <img src="{{ (printf "/img/%s" .Params.header.image) | relURL }}" class="article-banner" itemprop="image" alt="">
+  <img src="{{ (printf "/img/%s" .Params.header.image) | relURL }}" class="article-banner" alt="">
   {{ end }}
 
   {{ with .Params.header.caption }}<span class="article-header-caption">{{ . | markdownify | emojify }}</span>{{ end }}
@@ -53,7 +53,7 @@
 {{end}}
 
 <div class="article-container pt-3">
-  <h1 itemprop="name">{{ $title }}</h1>
+  <h1>{{ $title }}</h1>
 
   {{ with $page.Params.subtitle }}
   <p class="page-subtitle">{{ . | markdownify | emojify }}</p>
@@ -79,7 +79,7 @@
     {{ $ctnr = "universal-wrapper" }}
   {{end}}
 <div class="{{$ctnr}} pt-3">
-  <h1 itemprop="name">{{ $title }}</h1>
+  <h1>{{ $title }}</h1>
 
   {{ with $page.Params.subtitle }}
   <p class="page-subtitle">{{ . | markdownify | emojify }}</p>

+ 1 - 4
layouts/partials/page_metadata.html

@@ -2,9 +2,6 @@
 {{ $share := .share | default false }}
 {{ $page := .page }}
 
-<meta content="{{ $page.Params.Date }}" itemprop="datePublished">
-<meta content="{{ $page.Params.LastMod }}" itemprop="dateModified">
-
 <div class="article-metadata">
 
   {{/* If `authors` is set and is not empty. */}}
@@ -27,7 +24,7 @@
           {{ i18n "last_updated" }}
       {{ end }}
     {{ end }}
-    <time>{{ $date }}</time>
+    {{ $date }}
   </span>
   {{ end }}
 

+ 2 - 2
layouts/publication/single.html

@@ -1,6 +1,6 @@
 {{- define "main" -}}
 
-<div class="pub" itemscope itemtype="http://schema.org/CreativeWork">
+<div class="pub">
 
   {{ partial "page_header.html" . }}
 
@@ -8,7 +8,7 @@
 
     {{ if .Params.abstract }}
     <h3>{{ i18n "abstract" }}</h3>
-    <p class="pub-abstract" itemprop="text">{{ .Params.abstract | markdownify }}</p>
+    <p class="pub-abstract">{{ .Params.abstract | markdownify }}</p>
     {{ end }}
 
     {{ if (.Params.publication_types) and (ne (index .Params.publication_types 0) "0") }}