diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-06-05 22:11:41 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-06-05 22:11:41 +0200 |
| commit | 99d814c09d76be0574f78670c7a7080fad95a8f1 (patch) | |
| tree | 3f9cea75a01dfba6f2a4543502ea1f0b64549a5f /layouts/partials | |
| parent | 5913da424459f523357b114a683059d3fc4bef68 (diff) | |
| download | gohugo-theme-ed-99d814c09d76be0574f78670c7a7080fad95a8f1.tar.gz | |
Rework site keywords
Diffstat (limited to 'layouts/partials')
| -rw-r--r-- | layouts/partials/head.html | 10 | ||||
| -rw-r--r-- | layouts/partials/keywords.html | 16 |
2 files changed, 16 insertions, 10 deletions
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 06ef255..0b480fd 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,4 +1,3 @@ -{{/* */}} <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0,shrink-to-fit=no"> @@ -6,11 +5,10 @@ <link rel="canonical" href="{{ .Permalink }}"> <title>{{ block "title" . }}{{- partial "title.html" . -}}{{ end }}</title> - <meta name="description" content="{{ (partial "description.html" . ) }}"> - {{ if or .Params.tags site.Params.seoKeywords }} - <meta name="keywords" content="{{ (partial "keywords.html" . ) }}"> - {{ end }} - <meta name="author" content="{{ (partial "author.html" . ) }}"> + <meta name="description" content="{{ partial "description.html" . }}"> + <meta name="keywords" content="{{ partial "keywords.html" . }}"> + + <meta name="author" content="{{ partial "author.html" . }}"> {{ hugo.Generator }} {{- partial "styles.html" . }} diff --git a/layouts/partials/keywords.html b/layouts/partials/keywords.html index 275d52d..ab0dd2b 100644 --- a/layouts/partials/keywords.html +++ b/layouts/partials/keywords.html @@ -1,5 +1,13 @@ -{{- if .Params.tags -}} - {{- delimit .Params.tags ", " -}} -{{- else -}} - {{- delimit site.Params.seoKeywords ", " -}} +{{- $keywords := (slice) -}} + +{{- with .Keywords -}} + {{- $keywords = . -}} +{{- else }} + {{- with .Params.tags -}} + {{- $keywords = . -}} + {{- else -}} + {{- $keywords = site.Params.keywords | default slice -}} + {{- end -}} {{- end -}} + +{{- delimit $keywords ", " -}} |
