aboutsummaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/structured-data.html59
1 files changed, 26 insertions, 33 deletions
diff --git a/layouts/partials/structured-data.html b/layouts/partials/structured-data.html
index c55bcdd..eb42277 100644
--- a/layouts/partials/structured-data.html
+++ b/layouts/partials/structured-data.html
@@ -18,42 +18,41 @@
{{ else }}
<meta name="twitter:card" content="summary" />
{{ end }}
+
+{{ $desc := "" }}
+{{/* Generate page description. */}}
+{{ if .Params.description }}
+ {{ $desc = .Params.description }}
+{{ else if .Params.subtitle }}
+ {{ $desc = .Params.subtitle }}
+{{ else if .IsPage }}
+ {{ $desc = .Summary }}
+{{ else if .Params.excerpt }}
+ {{ $desc = .Params.excerpt }}
+{{ else }}
+ {{ $desc = site.Params.description }}
+{{ end }}
+<meta name="description" content="{{ $desc }}" />
+<meta property="og:site_name" content="{{ .Site.Title }}" />
+
<meta name="twitter:title" content="{{ .Title }}" />
-<meta
- name="twitter:description"
- content="{{ with .Description }}
- {{ . }}
- {{ else }}
- {{ if .IsPage }}
- {{ .Summary }}
- {{ else }}
- {{ with .Site.Params.description }}{{ . }}{{ end }}
- {{ end }}
- {{ end -}}"
-/>
+<meta name="twitter:description" content="{{ $desc }}" />
<meta property="og:title" content="{{ .Title }}" />
-<meta
- property="og:description"
- content="{{ with .Description }}
- {{ . }}
- {{ else }}
- {{ if .IsPage }}
- {{ .Summary }}
- {{ else }}
- {{ with .Site.Params.description }}{{ . }}{{ end }}
- {{ end }}
- {{ end }}"
-/>
+<meta property="og:description" content="{{ $desc }}" />
<meta
property="og:type"
- content="{{ if .IsPage }}
+ content="{{- if .IsPage -}}
article
- {{ else }}
+ {{- else -}}
website
- {{ end }}"
+ {{- end -}}"
/>
<meta property="og:url" content="{{ .Permalink }}" />
+<meta
+ property="og:locale"
+ content="{{ site.LanguageCode | default "en-us" }}"
+/>
{{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
@@ -73,12 +72,6 @@
{{- end -}}
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
-{{- with .Params.locale }}
- <meta property="og:locale" content="{{ . }}" />
-{{ end }}
-{{- with .Site.Params.title }}
- <meta property="og:site_name" content="{{ . }}" />
-{{ end }}
{{- with .Params.videos }}
{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" />