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 {
|
.posts-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-bottom: .5em;
|
margin-bottom: var(--pico-spacing);
|
||||||
|
|
||||||
> article {
|
> article {
|
||||||
padding-bottom: .5rem;
|
padding-bottom: var(--pico-spacing);
|
||||||
|
padding-left: var(--pico-spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* List of last posts, on the home page*/
|
/* List of last posts, on the home page*/
|
||||||
|
|
|
@ -1,20 +1,7 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<!-- List the 5 last posts if the home_post_list parameters is set to true -->
|
<!-- List the 5 last posts if the home_post_list parameters is set to true -->
|
||||||
{{ if .Site.Params.home_post_list }}
|
{{ if .Site.Params.home_post_list }}
|
||||||
<section class="home-posts-list">
|
{{ partial "home_post_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>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<section class="home-content">
|
<section class="home-content">
|
||||||
<!-- Content for home.html, as a sort of list page,
|
<!-- Content for home.html, as a sort of list page,
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
<!--
|
<!--
|
||||||
Ranges pages by the publish date, in reverse order, to display the
|
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
|
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 }}
|
{{ range .Pages.ByPublishDate.Reverse }}
|
||||||
<article>
|
<article>
|
||||||
<a href="{{ .Permalink }}">
|
<a href="{{ .Permalink }}">
|
||||||
{{.Title}}
|
{{.Title}}
|
||||||
</a>
|
</a>
|
||||||
{{ partial "lists-footer.html" . }}
|
{{ partial "lists-footer.html" . }}
|
||||||
|
|
|
@ -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