reafctor(head): rewrite description.html function

This commit is contained in:
Jimmy Cai
2020-09-11 23:00:19 +02:00
parent 6f5ee1bbdb
commit 5265af0b3b
4 changed files with 28 additions and 18 deletions
+12 -11
View File
@@ -1,11 +1,12 @@
{{- with .Description -}}
{{- . -}}
{{- else -}}
{{- if .IsPage -}}
{{- .Summary -}}
{{- else -}}
{{- with .Site.Params.subtitle -}}
{{- . -}}
{{- end -}}
{{- end -}}
{{- end -}}
<!-- Use site subtitle by default -->
{{ $description := .Site.Params.subtitle }}
{{ if .Description }}
<!-- Page description exists -->
{{ $description = .Description }}
{{ else if .IsPage }}
<!-- Use page summary -->
{{ $description = .Summary }}
{{ end }}
{{ return ($description | plainify)}}