diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a496b45..9425246 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,6 @@ {{ define "meta" }} {{- partial "section_meta.html" . -}} +{{- partial "opengraph_meta.html" . -}} {{ end }} {{ define "header" }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7bc2a80..d4484a0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,5 +1,6 @@ {{ define "meta" }} {{- partial "single_meta.html" . -}} +{{- partial "opengraph_meta.html" . -}} {{ end }} {{ define "header" }} diff --git a/layouts/index.html b/layouts/index.html index 7d22f69..74abd0d 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -3,6 +3,7 @@ {{ define "meta" }} {{- partial "section_meta.html" . -}} {{- partial "single_meta.html" . -}} +{{- partial "opengraph_meta.html" . -}} {{ end }} {{ define "header" }} diff --git a/layouts/partials/opengraph_meta.html b/layouts/partials/opengraph_meta.html new file mode 100644 index 0000000..45983fc --- /dev/null +++ b/layouts/partials/opengraph_meta.html @@ -0,0 +1,9 @@ +{{ if .IsPage -}} + +{{ else -}} + +{{ end -}} + + + +{{ with $.Param "image" }}{{ end }} diff --git a/layouts/partials/section_json_ld.html b/layouts/partials/section_json_ld.html index fc445eb..3d9fa27 100755 --- a/layouts/partials/section_json_ld.html +++ b/layouts/partials/section_json_ld.html @@ -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 -}} diff --git a/layouts/partials/single_json_ld.html b/layouts/partials/single_json_ld.html index 1f70b5f..cca4f10 100755 --- a/layouts/partials/single_json_ld.html +++ b/layouts/partials/single_json_ld.html @@ -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 -}} diff --git a/layouts/partials/single_meta.html b/layouts/partials/single_meta.html index e5e6171..9e3c134 100644 --- a/layouts/partials/single_meta.html +++ b/layouts/partials/single_meta.html @@ -1,4 +1,3 @@ - {{ with $.Param "author" }}{{ end }}