layout: add a partial for blog post data

* NEW Adds a partial for blog post data.
* NEW Displays date or publishdate, and lastmod if it exists.

Co-Authored-by: Igor Milhit <igor@milhit.ch>
pull/31/head
iGor milhit 2019-08-25 08:58:26 +02:00
parent 38566ba106
commit 02d6d2f086
Signed by: igor
GPG Key ID: 692D97C3D0228A99
2 changed files with 26 additions and 21 deletions

View File

@ -2,27 +2,7 @@
<main id="main" class="container">
<header class="post-header">
<h1 id="title">{{ .Title }}</h1>
<ul class="post-info">
<li>Publié le&#x202F;: {{ .Date.Format "2006-01-02" }}</li>
{{ with .Params.categories }}
<li>Catégories&#x202F;:
<ul>
{{ range . }}
<li><a href="{{ "categories" | absURL}}/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
</ul>
</li>
{{ end }}
{{ with .Params.tags }}
<li>Tags&#x202F;:
<ul>
{{ range . }}
<li> <a href="{{ "tags" | absURL }}/{{ . | urlize }}">{{ . }}</a> </li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>
{{- partial "post-info.html" . -}}
</header>
<article id="content">
{{ .Content }}

View File

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