From 56c7c70a72f162fd45c6efa8328936d437fb5ec4 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 19 Apr 2023 10:21:21 +0200
Subject: [PATCH] show description

---
 config.yaml                                   |  1 +
 .../blocks/templates/posts/highlight.html     | 20 ++++++++++---------
 layouts/partials/posts/post.html              | 20 ++++++++++---------
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/config.yaml b/config.yaml
index 1f3e4c12..1f388d9a 100644
--- a/config.yaml
+++ b/config.yaml
@@ -12,6 +12,7 @@ params:
     index:
       show_categories: false
       show_author: false
+      show_description: true
       truncate_description: 200 # Set to 0 to disable truncate
       layout: list # grid | list
   pages:
diff --git a/layouts/partials/blocks/templates/posts/highlight.html b/layouts/partials/blocks/templates/posts/highlight.html
index 9a2cc62f..3e1f8d8b 100644
--- a/layouts/partials/blocks/templates/posts/highlight.html
+++ b/layouts/partials/blocks/templates/posts/highlight.html
@@ -24,15 +24,17 @@
               {{ if site.Params.posts.index.show_categories }}
                 {{- partial "posts/categories" . -}}
               {{ end }}
-              {{- if (partial "GetTextFromHTML" .Params.summary) -}}
-                {{ if site.Params.posts.index.truncate_description }}
-                  <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
-                    "text" .Params.summary
-                    "length" site.Params.posts.index.truncate_description
-                    ) }}</p>
-                {{ else }}
-                  <p itemprop="articleBody">{{ partial "PrepareText" .Params.summary }}</p>
-                {{ end }}
+              {{ if site.Params.posts.index.show_description }}
+                {{- if (partial "GetTextFromHTML" .Params.summary) -}}
+                  {{ if site.Params.posts.index.truncate_description }}
+                    <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
+                      "text" .Params.summary
+                      "length" site.Params.posts.index.truncate_description
+                      ) }}</p>
+                  {{ else }}
+                    <p itemprop="articleBody">{{ partial "PrepareText" .Params.summary }}</p>
+                  {{ end }}
+                {{- end -}}
               {{- end -}}
 
               <div class="post-meta">
diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html
index df3fbd9a..e1dcc3b6 100644
--- a/layouts/partials/posts/post.html
+++ b/layouts/partials/posts/post.html
@@ -18,15 +18,17 @@
       {{- partial "posts/categories" . -}}
     {{ end }}
 
-    {{- if (partial "GetTextFromHTML" .Params.summary) -}}
-      {{ if site.Params.posts.index.truncate_description }}
-        <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
-          "text" .Params.summary
-          "length" site.Params.posts.index.truncate_description
-          ) }}</p>
-      {{ else }}
-        <p itemprop="articleBody">{{ partial "PrepareText" .Params.summary }}</p>
-      {{ end }}
+    {{ if site.Params.posts.index.show_description }}
+      {{- if (partial "GetTextFromHTML" .Params.summary) -}}
+        {{ if site.Params.posts.index.truncate_description }}
+          <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
+            "text" .Params.summary
+            "length" site.Params.posts.index.truncate_description
+            ) }}</p>
+        {{ else }}
+          <p itemprop="articleBody">{{ partial "PrepareText" .Params.summary }}</p>
+        {{ end }}
+      {{- end -}}
     {{- end -}}
     
     <div class="post-meta">
-- 
GitLab