From 24b5542ab72ebf3932b86e7265d2d16028ba137d Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Thu, 30 May 2024 23:24:37 -0700 Subject: [PATCH] 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. --- layouts/_default/archives.html | 2 +- layouts/_default/list.html | 2 +- layouts/_default/search.html | 2 +- layouts/_default/single.html | 2 +- layouts/_default/terms.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index eea3fc8a..32926030 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -20,7 +20,7 @@ {{- end }} {{- end }} - {{- if .Description }} + {{- if and (.Param "ShowDescription") .Description }}
{{ .Description }}
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 81aea6e4..9e917bd2 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -22,7 +22,7 @@ {{- end }} {{- end }} - {{- if .Description }} + {{- if and (.Param "ShowDescription") .Description }}
{{ .Description | markdownify }}
diff --git a/layouts/_default/search.html b/layouts/_default/search.html index bb7d436d..5e5e2cc6 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -8,7 +8,7 @@ - {{- if .Description }} + {{- if and (.Param "ShowDescription") .Description }}
{{ .Description }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 19a624f4..81db8ca9 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -14,7 +14,7 @@ {{- end }} - {{- if .Description }} + {{- if and (.Param "ShowDescription") .Description }}
{{ .Description }}
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 6fd26540..98b2faa0 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -3,7 +3,7 @@ {{- if .Title }}