From d9213fd81ef481e4ec00c276677e90c3cf161bb4 Mon Sep 17 00:00:00 2001
From: Olivia206 <olivia.simonet206@gmail.com>
Date: Fri, 3 May 2024 14:57:13 +0200
Subject: [PATCH] reset config and made some adjustments to posts large and
 hightlight

---
 config.yaml                                   |  6 ++
 layouts/partials/blocks/templates/posts.html  |  1 +
 .../blocks/templates/posts/highlight.html     |  6 +-
 .../blocks/templates/posts/large.html         |  6 +-
 layouts/partials/posts/post.html              | 90 +++++++++----------
 5 files changed, 57 insertions(+), 52 deletions(-)

diff --git a/config.yaml b/config.yaml
index 0160f9df..d2434eaa 100644
--- a/config.yaml
+++ b/config.yaml
@@ -81,6 +81,12 @@ params:
       show_description: true
       truncate_description: 200 # Set to 0 to disable truncate
       layout: list # grid | list
+      options:
+        hide_image: false
+        hide_summary: false
+        hide_category: false
+        hide_author: false
+        hide_date: false
     share_links:
       facebook: true
       twitter: true
diff --git a/layouts/partials/blocks/templates/posts.html b/layouts/partials/blocks/templates/posts.html
index af9fadeb..6d19f1de 100644
--- a/layouts/partials/blocks/templates/posts.html
+++ b/layouts/partials/blocks/templates/posts.html
@@ -3,6 +3,7 @@
 
 {{- $term := false -}}
 {{- $layout := .block.data.layout | default "grid" -}}
+
 {{- with .block.data }}
   {{- $options := dict 
     "hide_image" .hide_image
diff --git a/layouts/partials/blocks/templates/posts/highlight.html b/layouts/partials/blocks/templates/posts/highlight.html
index de4d08ae..4f46f762 100644
--- a/layouts/partials/blocks/templates/posts/highlight.html
+++ b/layouts/partials/blocks/templates/posts/highlight.html
@@ -32,10 +32,10 @@
               <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
             {{ $heading_tag.close }}
 
-            {{ if and site.Params.posts.index.show_categories (eq $options.hide_cathegory false) }}
+            {{ if eq $options.hide_cathegory false }}
               {{- partial "posts/categories" . -}}
             {{ end }}
-            {{ if and site.Params.posts.index.show_description (eq $options.hide_summary false) }}
+            {{ if eq $options.hide_summary false }}
               {{- if (partial "GetTextFromHTML" .Params.summary) -}}
                 <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
                   "text" .Params.summary
@@ -48,7 +48,7 @@
                 {{- if eq $options.hide_date false -}}
                   <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time>
                 {{ end }}
-                {{ if and site.Params.posts.index.show_author (eq $options.hide_author false) }}
+                {{ if eq $options.hide_author false }}
                   {{- partial "posts/author" . -}}
                 {{ end }}
               </div>
diff --git a/layouts/partials/blocks/templates/posts/large.html b/layouts/partials/blocks/templates/posts/large.html
index f54b79ee..f9c61b60 100644
--- a/layouts/partials/blocks/templates/posts/large.html
+++ b/layouts/partials/blocks/templates/posts/large.html
@@ -25,19 +25,19 @@
           {{ $heading_tag.close }}
           
           <div class="post-meta">
-            {{ if and site.Params.posts.index.show_author (eq $options.hide_author false) }}
+            {{ if eq $options.hide_author false }}
               {{- partial "posts/author" . -}}
             {{ end }}
             {{ if eq $options.hide_date false }}
               <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time>
             {{ end }}
-            {{ if and site.Params.posts.index.show_categories (eq $options.hide_cathegory false) }}
+            {{ if eq $options.hide_cathegory false }}
               {{- partial "posts/categories" . -}}
             {{ end }}
           </div>
 
 
-          {{ if and site.Params.posts.index.show_description (eq $options.hide_summary false) }}
+          {{ if eq $options.hide_summary false }}
             {{- if (partial "GetTextFromHTML" .Params.summary) -}}
               <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
                 "text" .Params.summary
diff --git a/layouts/partials/posts/post.html b/layouts/partials/posts/post.html
index b1149355..892102f8 100644
--- a/layouts/partials/posts/post.html
+++ b/layouts/partials/posts/post.html
@@ -15,56 +15,54 @@
 
 {{ with $post }}
 
-{{ if .Params.image }}
-  {{- $direction = partial "GetImageDirection" .Params.image -}}
-{{ end }}
+  {{ if .Params.image }}
+    {{- $direction = partial "GetImageDirection" .Params.image -}}
+  {{ end }}
 
-<article class='post {{ if $alternate }} {{- if (not (isset .Params "image")) -}} without-image {{- end -}}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
-  <div class="post-content">
-    {{- $title := partial "PrepareHTML" .Title -}}
+  <article class='post {{ if $alternate }} {{- if (not (isset .Params "image")) -}} without-image {{- end -}}{{ $direction }} {{if not (modBool $index 2)}}left{{ else}}right{{end}}{{end}}' itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
+    <div class="post-content">
+      {{- $title := partial "PrepareHTML" .Title -}}
 
-    {{ $heading_tag.open }}
-      <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
-    {{ $heading_tag.close }}
+      {{ $heading_tag.open }}
+        <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
+      {{ $heading_tag.close }}
 
-    {{ if and site.Params.posts.index.show_categories $show_category }}
-      {{- partial "posts/categories" . -}}
-    {{ end }}
+      {{ if $show_category }}
+        {{- partial "posts/categories" . -}}
+      {{ end }}
 
-    {{ if and site.Params.posts.index.show_description $show_summary }}
-      {{- if (partial "GetTextFromHTML" .Params.summary) -}}
-        <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
-          "text" .Params.summary
-          "length" site.Params.posts.index.truncate_description
-          ) }}</p>
-      {{- end -}}
-    {{- end -}}
-    
-    {{ if or $show_author $show_date }}
-      <div class="post-meta">
-        {{ if $show_date }}
-          <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time>
-        {{ end }}
-        {{ if and site.Params.posts.index.show_author $show_author }}
-          {{- partial "posts/author" . -}}
-        {{ end }}
-      </div>
-    {{ end }}
-
-
-  </div>
-  {{ if $show_image }}
-    <div class="media">
-      {{- if and .Params.image -}}
-        {{- partial "commons/image.html"
-            (dict
-              "image"    .Params.image
-              "sizes"    site.Params.image_sizes.sections.posts.item
-            ) -}}
-      {{- else -}}
-        {{- partial "commons/image-default.html" "posts" -}}
+      {{ if $show_summary }}
+        {{- if (partial "GetTextFromHTML" .Params.summary) -}}
+          <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
+            "text" .Params.summary
+            "length" site.Params.posts.index.truncate_description
+            ) }}</p>
+        {{- end -}}
       {{- end -}}
+      
+      {{ if or $show_author $show_date }}
+        <div class="post-meta">
+          {{ if $show_date }}
+            <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format site.Params.posts.date_format }}</time>
+          {{ end }}
+          {{ if $show_author }}
+            {{- partial "posts/author" . -}}
+          {{ end }}
+        </div>
+      {{ end }}
     </div>
-  {{- end -}}
-</article>
+    {{ if $show_image }}
+      <div class="media">
+        {{- if and .Params.image -}}
+          {{- partial "commons/image.html"
+              (dict
+                "image"    .Params.image
+                "sizes"    site.Params.image_sizes.sections.posts.item
+              ) -}}
+        {{- else -}}
+          {{- partial "commons/image-default.html" "posts" -}}
+        {{- end -}}
+      </div>
+    {{- end -}}
+  </article>
 {{ end }}
\ No newline at end of file
-- 
GitLab