Add an option to not display descriptions

.Description is meant to be used for metadata purpose: https://gohugo.io/methods/page/description/

Hugo document has emphasized this in the .Description page:

> Conceptually different from a content summary, a page description is typically used in metadata about the page.

Hugo embedded templates are consistent in this regard.

To maintain backward compatibility, add an option showDescription to
disable displaying descriptions.
This commit is contained in:
Hong Xu 2024-05-30 23:24:37 -07:00
parent 3f50861a0c
commit 24b5542ab7
5 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@
{{- end }}
{{- end }}
</h1>
{{- if .Description }}
{{- if and (.Param "ShowDescription") .Description }}
<div class="post-description">
{{ .Description }}
</div>

View File

@ -22,7 +22,7 @@
{{- end }}
{{- end }}
</h1>
{{- if .Description }}
{{- if and (.Param "ShowDescription") .Description }}
<div class="post-description">
{{ .Description | markdownify }}
</div>

View File

@ -8,7 +8,7 @@
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</h1>
{{- if .Description }}
{{- if and (.Param "ShowDescription") .Description }}
<div class="post-description">
{{ .Description }}
</div>

View File

@ -14,7 +14,7 @@
</span>
{{- end }}
</h1>
{{- if .Description }}
{{- if and (.Param "ShowDescription") .Description }}
<div class="post-description">
{{ .Description }}
</div>

View File

@ -3,7 +3,7 @@
{{- if .Title }}
<header class="page-header">
<h1>{{ .Title }}</h1>
{{- if .Description }}
{{- if and (.Param "ShowDescription") .Description }}
<div class="post-description">
{{ .Description }}
</div>