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 <igor@milhit.ch>dev
parent
83f45fefff
commit
264fc3480e
|
@ -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*/
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
{{ define "main" }}
|
||||
<!-- List the 5 last posts if the home_post_list parameters is set to true -->
|
||||
{{ if .Site.Params.home_post_list }}
|
||||
<section class="home-posts-list">
|
||||
<h2>{{ i18n "lastPosts" }}</h2>
|
||||
<!--
|
||||
Ranges regular pages by the publish date, in reverse order, to display the
|
||||
post titles of the section from most recent to older, and the category.
|
||||
-->
|
||||
{{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }}
|
||||
<article>
|
||||
<a href="{{ .Permalink }}">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ partial "home_post_list" . }}
|
||||
{{ end }}
|
||||
<section class="home-content">
|
||||
<!-- Content for home.html, as a sort of list page,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<!--
|
||||
Ranges pages by the publish date, in reverse order, to display the
|
||||
post titles of the section from most recent to older. It adds to
|
||||
the title the date and categories (from lists-footer.html)
|
||||
the title the date and categories (from lists-footer.html).
|
||||
-->
|
||||
{{ range .Pages.ByPublishDate.Reverse }}
|
||||
<article>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<section class="home-posts-list">
|
||||
<h2>{{ i18n "lastPosts" }}</h2>
|
||||
<!--
|
||||
Ranges regular pages by the publish date, in reverse order, to display the
|
||||
post titles of the section from most recent to older, and the category.
|
||||
-->
|
||||
{{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }}
|
||||
<article>
|
||||
<a href="{{ .Permalink }}">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
</section>
|
Loading…
Reference in New Issue