template: compare lastmod and publishdate

Most of blog posts have the lastmod displayed even if the publishdate is
the same day, because lastmod comes from git information and has also
hour, minutes and second, and publishdate is set manually, with only
year, month and day.

* Formats the date to compare them accurately, with datFormat function.
* Styles a little bit the blockquote tag.
* Spaces evenly the post information blocks.
* Closes #5

Co-Authored-by: Igor Milhit <igor@milhit.ch>
pull/31/head
iGor milhit 2020-05-22 12:25:50 +02:00
parent 4b492fa427
commit 7b43ee60e5
Signed by: igor
GPG Key ID: 692D97C3D0228A99
3 changed files with 8 additions and 2 deletions

View File

@ -34,4 +34,6 @@ dd {
} }
} }
blockquote {
font-style: italic;
}

View File

@ -13,6 +13,7 @@
.post-info { .post-info {
display: flex; display: flex;
justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0; padding: 0;
margin-top: 0; margin-top: 0;

View File

@ -1,6 +1,9 @@
{{ $LastmodFormatted := dateFormat "2006-01-02" (.Lastmod) }}
{{ $PublishdateFormatted := dateFormat "2006-01-02" (.PublishDate) }}
<ul class="post-info"> <ul class="post-info">
<li>Publié le&#x202F;: {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li> <li>Publié le&#x202F;: {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li>
{{ if (and (isset .Params "lastmod") (gt .Lastmod .PublishDate)) }} {{ if (and (isset .Params "lastmod") (gt $LastmodFormatted $PublishdateFormatted)) }}
<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 }} {{ end }}
{{ with .Params.categories }} {{ with .Params.categories }}