Added opengraph meta tags.
This commit is contained in:
parent
cf54dbd210
commit
3565ba1e72
7 changed files with 16 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
{{ define "meta" }}
|
||||
{{- partial "section_meta.html" . -}}
|
||||
{{- partial "opengraph_meta.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "header" }}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{{ define "meta" }}
|
||||
{{- partial "single_meta.html" . -}}
|
||||
{{- partial "opengraph_meta.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "header" }}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
{{ define "meta" }}
|
||||
{{- partial "section_meta.html" . -}}
|
||||
{{- partial "single_meta.html" . -}}
|
||||
{{- partial "opengraph_meta.html" . -}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "header" }}
|
||||
|
|
|
|||
9
layouts/partials/opengraph_meta.html
Normal file
9
layouts/partials/opengraph_meta.html
Normal 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 }}
|
||||
|
|
@ -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 -}}
|
||||
|
|
|
|||
|
|
@ -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 -}}
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue