فهرست منبع

feat(jsonld): add publisher to article metadata

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

Close #413
George Cushen 5 سال پیش
والد
کامیت
874a013b79
1فایلهای تغییر یافته به همراه11 افزوده شده و 0 حذف شده
  1. 11 0
      layouts/partials/jsonld/article.html

+ 11 - 0
layouts/partials/jsonld/article.html

@@ -22,6 +22,9 @@
   {{ $author = .Params.name | default .Title }}
 {{ end }}
 
+{{ $publisher := site.Params.org_name | default site.Title }}
+{{ $logo_url := printf "img/%s" (site.Params.logo | default "icon-512.png") | absURL }}
+
 <script type="application/ld+json">
 {
   "@context": "https://schema.org",
@@ -44,6 +47,14 @@
     "name": {{.}}
   },
   {{end}}
+  "publisher": {
+    "@type": "Organization",
+    "name": {{$publisher}},
+    "logo": {
+      "@type": "ImageObject",
+      "url": {{$logo_url}}
+    }
+  },
   "description": {{$summary}}
 }
 </script>