Added opengraph meta tags.

This commit is contained in:
Fredrik Jonsson 2018-03-02 11:14:55 +01:00
commit 3565ba1e72
7 changed files with 16 additions and 3 deletions

View file

@ -1,5 +1,6 @@
{{ define "meta" }}
{{- partial "section_meta.html" . -}}
{{- partial "opengraph_meta.html" . -}}
{{ end }}
{{ define "header" }}

View file

@ -1,5 +1,6 @@
{{ define "meta" }}
{{- partial "single_meta.html" . -}}
{{- partial "opengraph_meta.html" . -}}
{{ end }}
{{ define "header" }}

View file

@ -3,6 +3,7 @@
{{ define "meta" }}
{{- partial "section_meta.html" . -}}
{{- partial "single_meta.html" . -}}
{{- partial "opengraph_meta.html" . -}}
{{ end }}
{{ define "header" }}

View file

@ -0,0 +1,9 @@
{{ if .IsPage -}}
<meta name="description" content="{{ .Description | default (replaceRE "\n" " " .Summary) }}">
{{ else -}}
<meta name="description" content="{{ $.Param "description" }}">
{{ end -}}
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:title" content="{{ .Title }}">
<meta property="og:url" content="{{ .Permalink }}">
{{ with $.Param "image" }}<meta name="og:image" content="{{ . | absURL }}">{{ end }}

View file

@ -4,7 +4,9 @@
"@type": "WebSite",
"url" : "{{ .Permalink }}",
"name": {{ .Title | jsonify }},
"description": {{ $.Param "description" | jsonify }},
{{ with $.Param "description" -}}
"description": {{ . | jsonify }},
{{ end -}}
{{ with $.Param "image" -}}
"image" : "{{ . | absURL }}",
{{ end -}}

View file

@ -6,7 +6,7 @@
"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 }},
"description": {{ with (.Description | default (replaceRE "\n" " " .Summary)) }}{{ . | jsonify }}{{ end }},
{{ with $.Param "image" -}}
"image" : "{{ . | absURL }}",
{{ end -}}

View file

@ -1,4 +1,3 @@
<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 }}