Added json-ld and fixes to meta tags.

This commit is contained in:
Fredrik Jonsson 2017-10-24 11:45:29 +02:00
commit fb2dcc80cb
5 changed files with 35 additions and 1 deletions

View file

@ -6,6 +6,7 @@
{{ block "meta" . }}{{ end }}
{{- partial "meta.html" . -}}
{{- partialCached "meta_cache.html" . -}}
{{ block "header" . }}{{ end }}
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID }}{{ partialCached "piwik.html" . }}{{ end -}}
</head>

View file

@ -2,6 +2,10 @@
{{- partial "single_meta.html" . -}}
{{ end }}
{{ define "header" }}
{{- partial "single_json_ld.html" . -}}
{{ end }}
{{ define "main" -}}
<main class="main layout__main" role="main">
<h1 class="title {{ if $.Param "submitted" | default false }}title-submitted{{ end }}">{{ .Title }}</h1>

View file

@ -14,4 +14,3 @@
{{ end -}}
</ul>
</nav>

View file

@ -0,0 +1,29 @@
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": {{ .Title | jsonify }},
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}",
"url" : "{{ .Permalink }}",
"description": {{ with (replaceRE "\n" "" (.Description | default .Summary)) }}{{ . | jsonify }}{{ end }},
{{ with .Params.tags -}}
"keywords": {{ . | jsonify }},
{{ end -}}
{{ with $.Param "author" -}}
"author": {
"@type": "Person",
"name": "{{ . }}"
},
{{ end -}}
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "{{ .Site.BaseURL }}"
},
"publisher": {
"@type": "Organization",
"name": "{{ .Site.Title }}",
"url": "{{ .Site.BaseURL }}",
}
}
</script>

View file

@ -1,3 +1,4 @@
<meta name="description" content="{{ replaceRE "\n" "" (.Description | default .Summary) }}">
<meta name="created" content="{{ .Date.Format "2006-01-02T15:04:05-0700" }}">
<meta name="modified" content="{{ .Lastmod.Format "2006-01-02T15:04:05-0700" }}">
{{ with $.Param "author" }}<meta name="author" content="{{ . }}">{{ end }}