Add logic to use .Description instead of .Summary

Adds a check for a useDescription param which will check for a
description field in a post and use it instead of the .Summary when
producing list.html. If a description is unavailable and hideSummary is
not true, the summary will show as normal.
This commit is contained in:
Mason Wilde 2023-10-28 14:20:30 -06:00
parent efe4cb4516
commit 83e9267996

View File

@ -72,7 +72,11 @@
{{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }} {{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }}
</h2> </h2>
</header> </header>
{{- if (ne (.Param "hideSummary") true) }} {{- if and (.Description) (.Param "useDescription") }}
<div class="entry-content">
<p>{{ .Description | plainify | htmlUnescape }}</p>
</div>
{{- else if (ne (.Param "hideSummary") true) }}
<div class="entry-content"> <div class="entry-content">
<p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p> <p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p>
</div> </div>