Include topics in meta description tag

This commit is contained in:
Jez Cope 2021-04-09 20:35:44 +01:00
parent 4e21f00999
commit c802241deb
1 changed files with 6 additions and 1 deletions

View File

@ -5,7 +5,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ .Title }}</title>
{{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }}
{{ .Scratch.Set "desc" slice }}
{{ with .Site.Params.description }}{{ $.Scratch.Add "desc" (slice .) }}{{ end }}
{{ with .Site.Params.topics }}{{ $.Scratch.Add "desc" (slice (delimit . " & ")) }}{{ end }}
{{ if gt (len (.Scratch.Get "desc")) 0 }}
<meta name="description" content="{{ delimit (.Scratch.Get "desc") " " }}">
{{ end }}
{{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
{{ $style := resources.Get "style/main.sass" | resources.ToCSS }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">