diff options
author | v1ne <v1ne2go@gmail.com> | 2019-11-20 00:12:28 +0300 |
---|---|---|
committer | Carson Ip <carsonip@users.noreply.github.com> | 2019-11-29 18:04:51 +0300 |
commit | 95686c0326844bcd333cf0c209059e7360308ec9 (patch) | |
tree | eff3cb7126b70a50a0f81c4116d58be96a8e0a2a | |
parent | b87555512af1c6f2d29f937873451b0ac2c6d38a (diff) |
Meta: Only print meta entries if they are actually defined
-rw-r--r-- | layouts/partials/meta.html | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 6a1975a..fec0354 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -1,6 +1,9 @@ + {{- $author := .Site.Params.Author -}} + {{- $description := or (.Description) (.Site.Params.Description) -}} + {{- $keywords := or (.Keywords) (.Site.Params.Keywords) -}} <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> - <meta name="description" content="{{ .Site.Params.Description }}"> - <meta name="keywords" content="{{ range .Site.Params.Keywords }}{{ . }},{{ end }}"> - <meta name="author" content="{{ .Site.Params.Author }}">
\ No newline at end of file + {{ if $author -}} <meta name="author" content="{{ range $author }} {{ .displayname }}, {{ end}}"> {{- end }} + {{ if $description -}} <meta name="description" content="{{ $description }}"> {{- end }} + {{ if $keywords -}} <meta name="keywords" content="{{ range $keywords }}{{ . }},{{ end }}"> {{- end }} |