diff options
author | Oscar Najera <hi@oscarnajera.com> | 2025-01-22 00:00:01 +0100 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2025-01-22 00:00:01 +0100 |
commit | aefe0904492698d2996d59d3f86a0fe9af0f688b (patch) | |
tree | 6bfe71f0c09637b45ddf0c45a1c433d77ac29087 /layouts/partials/structured-data.html | |
parent | e263209a4042c12a265a61eee9c748c6edf247f2 (diff) | |
download | hugo-minimalist-theme-aefe0904492698d2996d59d3f86a0fe9af0f688b.tar.gz hugo-minimalist-theme-aefe0904492698d2996d59d3f86a0fe9af0f688b.tar.bz2 hugo-minimalist-theme-aefe0904492698d2996d59d3f86a0fe9af0f688b.zip |
page metadata for SEO
Diffstat (limited to 'layouts/partials/structured-data.html')
-rw-r--r-- | layouts/partials/structured-data.html | 59 |
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 }}" /> |