Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/humrochagf/colordrop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layouts/blog/list.html6
-rw-r--r--layouts/blog/single.html6
-rw-r--r--layouts/partials/blog-jsonld.html22
-rw-r--r--layouts/partials/blog-post-jsonld.html22
-rw-r--r--layouts/partials/person-jsonld.html4
5 files changed, 59 insertions, 1 deletions
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index b6aee5c..3c7aa08 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -1,3 +1,9 @@
+{{ define "jsonLD" }}
+ <script type="application/ld+json">
+ {{ partial "blog-jsonld" . | safeJS }}
+ </script>
+{{ end }}
+
{{ define "main" }}
{{ range .Pages }}
<article>
diff --git a/layouts/blog/single.html b/layouts/blog/single.html
index 94ad948..998e368 100644
--- a/layouts/blog/single.html
+++ b/layouts/blog/single.html
@@ -1,3 +1,9 @@
+{{ define "jsonLD" }}
+ <script type="application/ld+json">
+ {{ partial "blog-post-jsonld" . | safeJS }}
+ </script>
+{{ end }}
+
{{ define "main" }}
<article>
<h1 class="title">{{ .Title }}</h1>
diff --git a/layouts/partials/blog-jsonld.html b/layouts/partials/blog-jsonld.html
new file mode 100644
index 0000000..04e438f
--- /dev/null
+++ b/layouts/partials/blog-jsonld.html
@@ -0,0 +1,22 @@
+{
+ "@context": "http://schema.org",
+ "@type": "Blog",
+ "author": {
+ "@type": "Person",
+ "name": "{{ .Site.Params.author.name }}",
+ {{ with .Site.GetPage "/about" }}
+ "url": "{{ .Permalink }}"
+ {{ end }}
+ },
+ "blogPost": [
+ {{ range $index, $page := .Pages }}
+ {{ if $index }},{{ end }}
+ {
+ "@type": "BlogPosting",
+ "headline": "{{ $page.Title }}",
+ "url": "{{ $page.Permalink }}",
+ "datePublished": "{{ $page.PublishDate.Format "2006-01-02" }}"
+ }
+ {{ end }}
+ ]
+}
diff --git a/layouts/partials/blog-post-jsonld.html b/layouts/partials/blog-post-jsonld.html
new file mode 100644
index 0000000..5cfe8b2
--- /dev/null
+++ b/layouts/partials/blog-post-jsonld.html
@@ -0,0 +1,22 @@
+{
+ "@context": "http://schema.org",
+ "@type": "BlogPosting",
+ "headline": "{{ .Title }}",
+ "url": "{{ .Permalink }}",
+ "datePublished": "{{ .PublishDate.Format "2006-01-02" }}",
+ "image": {
+ "@type": "ImageObject",
+ {{ if .Params.shareImage }}
+ "url": "{{ .Params.shareImage | absURL }}"
+ {{ else }}
+ "url": "{{ .Site.Params.siteLogo | absURL }}"
+ {{ end }}
+ },
+ "author": {
+ "@type": "Person",
+ "name": "{{ .Site.Params.author.name }}",
+ {{ with .Site.GetPage "/about" }}
+ "url": "{{ .Permalink }}"
+ {{ end }}
+ }
+}
diff --git a/layouts/partials/person-jsonld.html b/layouts/partials/person-jsonld.html
index b554f81..157255b 100644
--- a/layouts/partials/person-jsonld.html
+++ b/layouts/partials/person-jsonld.html
@@ -2,7 +2,9 @@
"@context": "http://schema.org/",
"@type": "Person",
"name": "{{ .Site.Params.author.name }}",
- "url": "{{ .Permalink }}",
+ {{ with .Site.GetPage "/about" }}
+ "url": "{{ .Permalink }}",
+ {{ end }}
"jobTitle": "{{ .Site.Params.author.jobTitle }}",
"gender": "{{ .Site.Params.author.gender }}",
"image": "{{ .Site.Params.author.image | absURL }}",