head: update description and keywords logic

This commit is contained in:
Aditya Telange 2020-10-17 16:00:46 +05:30
parent 353146891e
commit 7db1be3d73
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 6 additions and 7 deletions

View File

@ -4,13 +4,12 @@
<!-- Title --> <!-- Title -->
<title>{{ if .IsHome }}{{else}}{{ if .Title }}{{ .Title }} - {{ end }}{{end}}{{ .Site.Title }}</title> <title>{{ if .IsHome }}{{else}}{{ if .Title }}{{ .Title }} - {{ end }}{{end}}{{ .Site.Title }}</title>
<!-- Meta --> <!-- Meta -->
{{- if in site.Params.mainSections .Type }} <meta name="keywords" content="{{ if .Params.keywords -}}
<meta name="description" content="{{ .Summary }}"> {{- range $i, $e := .Params.keywords }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- else }}
<meta name="keywords" content={{ delimit .Keywords ", " }} /> {{- range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }} {{- end -}}" />
{{- else }} <meta name="description" content="{{- with .Description }}{{ . }}{{- else }}{{- if .IsPage}}
<meta name="description" {{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }}
content="{{if .IsHome}}{{ .Site.Params.description }}{{else}}{{ .Title }} - {{ .Site.Title }}{{end}}"> {{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
{{- end }}
<meta name="author" content="{{ .Params.author | default .Site.Params.author }}"> <meta name="author" content="{{ .Params.author | default .Site.Params.author }}">
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" />
{{- if .Site.Params.analytics.google.SiteVerificationTag }} {{- if .Site.Params.analytics.google.SiteVerificationTag }}