From eac53f66f73ced5c1320fc0862102ae88c925007 Mon Sep 17 00:00:00 2001
From: alexanderdavide <alexeble1998@gmail.com>
Date: Sat, 12 Feb 2022 17:01:34 +0000
Subject: [PATCH] refactor: extract and unify wrapper to baseof
---
layouts/index.html | 159 +++++++++++++++++++++++++---------------------------
1 files changed, 76 insertions(+), 83 deletions(-)
diff --git a/layouts/index.html b/layouts/index.html
index 997effd..06e822f 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,5 +1,26 @@
{{ define "main" }}
- <main class="post-wrapper">
+ <div
+ class="post {{ with .Site.Params.doNotLoadAnimations }}
+ .
+
+ {{ else }}
+ animated fadeInDown
+
+ {{ end }}"
+ >
+ <div class="post__content">
+ {{ .Content }}
+ </div>
+
+ <!-- (Optional) Home
+ -- on top of `mainSections` content (aka posts) ;
+ -- as declared in content/_index.md
+
+ One can set `mainSections = [""]` and have the content/_index.md specified here
+ -->
+ </div>
+
+ {{ if .Params.mainSectionsTitle }}
<div
class="post {{ with .Site.Params.doNotLoadAnimations }}
.
@@ -10,111 +31,83 @@
{{ end }}"
>
<div class="post__content">
- {{ .Content }}
+ <h2>{{ .Params.mainSectionsTitle }}</h2>
</div>
-
- <!-- (Optional) Home
- -- on top of `mainSections` content (aka posts) ;
- -- as declared in content/_index.md
-
- One can set `mainSections = [""]` and have the content/_index.md specified here
- -->
</div>
- {{ if .Params.mainSectionsTitle }}
- <div
- class="post {{ with .Site.Params.doNotLoadAnimations }}
- .
+ {{ end }}
- {{ else }}
- animated fadeInDown
+ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
+ {{ range $paginator.Pages }}
+ <div
+ class="post {{ with .Site.Params.doNotLoadAnimations }}
+ .
- {{ end }}"
- >
- <div class="post__content">
- <h2>{{ .Params.mainSectionsTitle }}</h2>
+ {{ else }}
+ animated fadeInDown
+
+ {{ end }}"
+ >
+ {{ if .Params.thumbnail }}
+ <div class="post__thumbnail-wrapper">
+ <a href="{{ .RelPermalink }}">
+ <img class="post__thumbnail" src="{{ .Params.thumbnail | relURL }}" alt="Thumbnail image" loading="lazy" />
+ </a>
</div>
+
+ {{ end }}
+ <div class="post__content">
+ <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
</div>
+ <p>
+ {{ if .Site.Params.fullPostContent }}
+ {{ .Content }}
- {{ end }}
-
- {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
- {{ range $paginator.Pages }}
- <div
- class="post {{ with .Site.Params.doNotLoadAnimations }}
- .
{{ else }}
- animated fadeInDown
+ {{ .Summary }}
- {{ end }}"
- >
- {{ if .Params.thumbnail }}
- <div class="post__thumbnail-wrapper">
- <a href="{{ .RelPermalink }}">
- <img
- class="post__thumbnail"
- src="{{ .Params.thumbnail | relURL }}"
- alt="Thumbnail image"
- loading="lazy"
- />
- </a>
- </div>
{{ end }}
- <div class="post__content">
- <h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
- </div>
- <p>
- {{ if .Site.Params.fullPostContent }}
- {{ .Content }}
+ </p>
+ <!-- add read more -->
+ {{- if and (.Truncated) (.Site.Params.readMore) -}}
+ <a href="{{ .RelPermalink }}" class="post__more">{{ i18n "read_more" }}</a>
+
+ {{- end -}}
+
+
+ <!-- -->
+ <div class="post__footer">
+ <em class="fas fa-calendar-day"></em>
+ <span class="post__footer-date"
+ >{{ if isset .Site.Params "indexdateformat" }}
+ {{ .Date.Format .Site.Params.indexDateFormat }}
{{ else }}
- {{ .Summary }}
+ {{ .Date.Format "Mon, Jan 2, 2006" }}
- {{ end }}
- </p>
- <!-- add read more -->
- {{- if and (.Truncated) (.Site.Params.readMore) -}}
- <a href="{{ .RelPermalink }}" class="post__more">{{ i18n "read_more" }}</a>
-
- {{- end -}}
+ {{ end }}</span
+ >
+ {{ with .Page.Params.Categories }}
+ {{ partial "taxonomy/categories.html" . }}
- <!-- -->
- <div class="post__footer">
- <em class="fas fa-calendar-day"></em>
- <span class="post__footer-date"
- >{{ if isset .Site.Params "indexdateformat" }}
- {{ .Date.Format .Site.Params.indexDateFormat }}
+ {{ end }}
+
+ {{ with .Page.Params.Tags }}
+ {{ partial "taxonomy/tags.html" . }}
- {{ else }}
- {{ .Date.Format "Mon, Jan 2, 2006" }}
-
-
- {{ end }}</span
- >
- {{ with .Page.Params.Categories }}
- {{ partial "taxonomy/categories.html" . }}
-
-
- {{ end }}
-
- {{ with .Page.Params.Tags }}
- {{ partial "taxonomy/tags.html" . }}
-
-
- {{ end }}
- </div>
+ {{ end }}
</div>
-
- {{ end }}
- <div class="pagination">
- {{ template "partials/pagination.html" . }}
</div>
- </main>
+
+ {{ end }}
+ <div class="pagination">
+ {{ template "partials/pagination.html" . }}
+ </div>
{{ end }}
--
Gitblit v1.10.0