Merge pull request #508 from schnerring/flexsearch-description

Add .Summary as fallback for description
This commit is contained in:
Henk Verlinde 2021-10-14 17:20:43 +02:00 committed by GitHub
commit 6a7df65298
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -103,7 +103,11 @@ Source:
id: {{ $index }},
href: "{{ .RelPermalink }}",
title: {{ .Title | jsonify }},
description: {{ .Params.description | jsonify }},
{{ with .Description -}}
description: {{ . | jsonify }},
{{ else -}}
description: {{ .Summary | plainify | jsonify }},
{{ end -}}
content: {{ .Content | jsonify }}
})
{{ if ne (add $index 1) $len -}}

View File

@ -19,7 +19,11 @@
{{ with .Description -}}
<meta name="description" content="{{ . }}">
{{ else -}}
<meta name="description" content="{{ .Site.Params.description }}">
{{ with .Summary | plainify -}}
<meta name="description" content="{{ . }}">
{{ else -}}
<meta name="description" content="{{ .Site.Params.description }}">
{{ end -}}
{{ end -}}
{{ if $.Scratch.Get "paginator" }}