Improve the JSON-LD output and add it to sections and front page as well.
This commit is contained in:
parent
b72dca040b
commit
f25ad69da2
4 changed files with 40 additions and 3 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
{{- partial "section_meta.html" . -}}
|
{{- partial "section_meta.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "header" }}
|
||||||
|
{{- partial "section_json_ld.html" . -}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main" role="main">
|
<main class="main layout__main" role="main">
|
||||||
<h1 class="title">{{ .Title }}</h1>
|
<h1 class="title">{{ .Title }}</h1>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@
|
||||||
{{- partial "single_meta.html" . -}}
|
{{- partial "single_meta.html" . -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ define "header" }}
|
||||||
|
{{- partial "section_json_ld.html" . -}}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main" -}}
|
{{ define "main" -}}
|
||||||
<main class="main layout__main" role="main">
|
<main class="main layout__main" role="main">
|
||||||
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
<article class="{{ with .Section }}section-{{ . | urlize }} {{ end }}single-view">
|
||||||
|
|
|
||||||
26
layouts/partials/section_json_ld.html
Executable file
26
layouts/partials/section_json_ld.html
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "WebSite",
|
||||||
|
"url" : "{{ .Permalink }}",
|
||||||
|
"name": {{ .Title | jsonify }},
|
||||||
|
"description": {{ $.Param "description" | jsonify }},
|
||||||
|
{{ with $.Param "image" -}}
|
||||||
|
"image" : "{{ . | absURL }}",
|
||||||
|
{{ end -}}
|
||||||
|
{{ with $.Param "author" -}}
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": {{ . | jsonify }}
|
||||||
|
},
|
||||||
|
{{ end -}}
|
||||||
|
"mainEntityOfPage": {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": "{{ .Site.BaseURL }}"
|
||||||
|
},
|
||||||
|
"publisher": {
|
||||||
|
"@type": "Organization",
|
||||||
|
"name": {{ .Site.Title | jsonify }},
|
||||||
|
"url": "{{ .Site.BaseURL }}",
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -6,14 +6,17 @@
|
||||||
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
|
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
|
||||||
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
|
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
|
||||||
"url" : "{{ .Permalink }}",
|
"url" : "{{ .Permalink }}",
|
||||||
"description": {{ with (replaceRE "\n" " " (.Description | default .Summary)) }}{{ . | jsonify }}{{ end }},
|
"description": {{ with (replaceRE "\n" " " (.Description | default .Summary)) }}{{ . | jsonify }}{{ end }},
|
||||||
|
{{ with $.Param "image" -}}
|
||||||
|
"image" : "{{ . | absURL }}",
|
||||||
|
{{ end -}}
|
||||||
{{ with .Params.tags -}}
|
{{ with .Params.tags -}}
|
||||||
"keywords": {{ . | jsonify }},
|
"keywords": {{ . | jsonify }},
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{ with $.Param "author" -}}
|
{{ with $.Param "author" -}}
|
||||||
"author": {
|
"author": {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": "{{ . }}"
|
"name": {{ . | jsonify }}
|
||||||
},
|
},
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
"mainEntityOfPage": {
|
"mainEntityOfPage": {
|
||||||
|
|
@ -22,7 +25,7 @@
|
||||||
},
|
},
|
||||||
"publisher": {
|
"publisher": {
|
||||||
"@type": "Organization",
|
"@type": "Organization",
|
||||||
"name": "{{ .Site.Title }}",
|
"name": {{ .Site.Title | jsonify }},
|
||||||
"url": "{{ .Site.BaseURL }}",
|
"url": "{{ .Site.BaseURL }}",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue