layout: improve post info in single or list pages

* Adds a lists-footer partial.
* Uses breakpoints to adapt how the post informations is aligned and
  separated when the screen gets bigger.
* Adds some space between posts in a list or section, to improve
  readability.
* Removes useless article level and renames a section into article in
  the list template.
* Uses breakpoints to adapt the navigation font-size when the screen
  gets bigger.
* Improves the font-size variables, in order to get a font-size-small
  smaller.
* Restores the section template that wasn't right, I don't know what
  I've done when rebasing and resolving conflicts…

Co-Authored-by: Igor Milhit <igor@milhit.ch>
merge-requests/4/head
iGor milhit 2019-08-25 17:54:11 +02:00
parent e1cf9185f3
commit 817756034b
Signed by: igor
GPG Key ID: 692D97C3D0228A99
8 changed files with 76 additions and 54 deletions

View File

@ -20,6 +20,12 @@ nav,
font-size: $font-size-small;
}
@include breakpoint(laptop) {
nav {
font-size: $font-size-base;
}
}
.content {
line-height: 1.4; // TODO: fix homepage
}

View File

@ -8,5 +8,9 @@
display: flex;
flex-direction: column;
margin-bottom: .5em;
> article {
padding-bottom: .5rem;
}
}

View File

@ -13,14 +13,12 @@
}
.post-info {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
font-size: $font-size-small;
margin-top: 0;
padding: 0;
> li {
padding-right: .5rem;
padding-right: .3rem;
}
li {
@ -41,8 +39,27 @@
}
}
@include breakpoint(tablet) {
.post-info {
display: flex;
flex-wrap: wrap;
> li:not(:last-child) {
&::after {
content: ' /';
white-space: pre;
}
}
}
}
.post-taxonomies:not(:last-child) {
&::after {
content: ', ';
}
}
.list-footer {
font-size: $font-size-small;
padding-left: .5em;
}

View File

@ -4,8 +4,9 @@
// //
///////////////////
$font-size-base: 1.25rem; // 20 px
$font-size-small: 1rem; // 16 px
$font-size-base: 1.25rem !default; // 25 px
$font-size-small: .9rem; // 18 px
/////////////////////
// //

View File

@ -1,22 +1,18 @@
{{ define "main" }}
<header>
<h1>{{.Title}}</h1>
</header>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
<article class="posts-list">
<!-- Ranges through content/posts/*.md -->
{{ range .Pages.ByPublishDate.Reverse }}
<article class="posts-list">
<main class="container">
<header>
<h1>{{.Title}}</h1>
</header>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
<article class="posts-list">
<!-- Ranges through content/posts/*.md -->
{{ range .Pages }}
<article>
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a>
<a href="{{.Permalink}}">{{.Title}}</a>
{{ partial "lists-footer.html" . }}
</article>
<footer>
{{ if isset .Params "publishdate" }}
{{.PublishDate.Format "2006-01-02"}}
{{ end }}
</footer>
</article>
{{ end }}
</article>
{{ end }}
</article>
</main>
{{ end }}

View File

@ -1,31 +1,21 @@
{{ define "main" }}
<header>
<h1>{{.Title}}</h1>
</header>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
<section>
<header>
{{.Content }}
<header>
<h1>{{.Title}}</h1>
</header>
<section class="posts-list">
{{ range .Pages.ByPublishDate.Reverse }}
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
<article>
<header>
{{.Content }}
</header>
<article class="posts-list">
<article>
<a href="{{ .Permalink }}">
{{.Title}}
</a>
</article>
<footer>
{{ .PublishDate.Format "2006-01-02" }}
{{ with .Params.categories }}
{{ range . }}
/ <a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }}
</footer>
{{ range .Pages.ByPublishDate.Reverse }}
<article>
<a href="{{ .Permalink }}">
{{.Title}}
</a>
{{ partial "lists-footer.html" . }}
</article>
{{ end }}
</article>
{{ end }}
</section>
</section>
</article>
{{ end }}

View File

@ -0,0 +1,9 @@
<footer class="list-footer">
{{ .Date.Format "2006-01-02" }}
{{ with .Params.categories }}
{{ range sort . }}
/ <a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }}
</footer>

View File

@ -1,13 +1,13 @@
<ul class="post-info">
<li>Publié le&#x202F;: {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li>
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2006-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
<li>Dernière mise à jour&#x202F;: {{ .Lastmod.Format "2006-01-02" }}</li>
<li>Dernière mise à jour&#x202F;: {{ .Lastmod.Format "2006-01-02" }}</li>
{{ end }}
{{ with .Params.categories }}
<li>Catégories&#x202F;:
<ul>
{{ range sort . }}
<li class="post-taxonomies"> <a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a> </li>
<li><a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a></li>
{{ end }}
</ul>
</li>
@ -16,10 +16,9 @@
<li>Tags&#x202F;:
<ul>
{{ range sort . }}
<li class="post-taxonomies"> <a href="{{ "tags" | absURL }}/{{ . | urlize }}">{{ . }}</a> </li>
<li class="post-taxonomies"> <a href="{{ "tags" | absURL }}/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>