show frontmatter description if available as summary

This commit is contained in:
Gabriele Musco 2022-04-02 17:28:19 +02:00
parent 3ae446e96d
commit 49b6f15701
No known key found for this signature in database
GPG Key ID: 0587A5D65B5DC99E
3 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,7 @@
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (sort (or .Params.tags slice))
"summary" .Summary
"summary" (or .Params.description .Summary)
"text" (lower .Plain)
"link" .Permalink
"image" (or .Params.Image "")) }}

View File

@ -15,7 +15,7 @@
"title" .Title
"date" (.Date.Format "2006-01-02")
"tags" (sort (or .Params.tags slice))
"summary" .Summary
"summary" (or .Params.description .Summary)
"link" .Permalink
"image" (or .Params.Image "")) }}
{{ end }}

View File

@ -23,7 +23,13 @@
{{end}}
{{ if (site.Params.articleSummary | default true) }}
<div class="articlePreview">
<p>{{ .Summary }}</p>
<p>
{{ if .Params.description }}
{{ .Params.description }}
{{ else }}
{{.Summary }}
{{ end }}
</p>
<p><a href="{{ .Permalink }}">{{ i18n "continueReading" }} </a></p>
</div>
{{ end }}