From 264fc3480e6eb9f7a21df632eefe9e596cb174b3 Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Sun, 8 Dec 2024 08:55:51 +0100 Subject: [PATCH] layouts: allow lists to be overwritten - Replace fixed spacing by the pico variable, and improve the horizontal spacing of lists of posts (sections). - Place the list of last posts of the home page on a separate partial. Thus, this partial is easier to overwrite in the user layout directory. Co-Authored-by: iGor milhit --- assets/scss/_lists.scss | 6 ++++-- layouts/_default/home.html | 15 +-------------- layouts/_default/section.html | 4 ++-- layouts/partials/home_post_list.html | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 layouts/partials/home_post_list.html diff --git a/assets/scss/_lists.scss b/assets/scss/_lists.scss index 8c1cc70..760d877 100644 --- a/assets/scss/_lists.scss +++ b/assets/scss/_lists.scss @@ -8,11 +8,13 @@ .posts-list { display: flex; flex-direction: column; - margin-bottom: .5em; + margin-bottom: var(--pico-spacing); > article { - padding-bottom: .5rem; + padding-bottom: var(--pico-spacing); + padding-left: var(--pico-spacing); } + } /* List of last posts, on the home page*/ diff --git a/layouts/_default/home.html b/layouts/_default/home.html index add0c47..02875bc 100644 --- a/layouts/_default/home.html +++ b/layouts/_default/home.html @@ -1,20 +1,7 @@ {{ define "main" }} {{ if .Site.Params.home_post_list }} -
-

{{ i18n "lastPosts" }}

- - {{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }} - - {{ end }} -
+ {{ partial "home_post_list" . }} {{ end }}
{{ range .Pages.ByPublishDate.Reverse }}
- + {{.Title}} {{ partial "lists-footer.html" . }} diff --git a/layouts/partials/home_post_list.html b/layouts/partials/home_post_list.html new file mode 100644 index 0000000..cbc45c5 --- /dev/null +++ b/layouts/partials/home_post_list.html @@ -0,0 +1,14 @@ +
+

{{ i18n "lastPosts" }}

+ + {{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }} + + {{ end }} +