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 }}
{{- end }} {{- end }}
</h1> </h1>
{{- if .Description }} {{- if and (.Param "ShowDescription") .Description }}
<div class="post-description"> <div class="post-description">
{{ .Description }} {{ .Description }}
</div> </div>

View file

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

View file

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

View file

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

View file

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