cremeaux/layouts/home.html

57 lines
2.2 KiB
HTML

{{ define "main" }}
<div class="container">
<h1>Le fil <strong>des actualités</strong></h1>
<div class="infos">
<div class="news">
{{ $headless := .Site.GetPage "/actualites" }}
{{ $lastnews := first 4 (sort $headless.Pages "Date" "desc") }}
{{ $first := index (first 1 $lastnews) 0 }}
{{ $others := after 1 $lastnews }}
{{ with $first }}
<div class="post last">
<div class="picture">
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
{{ $resized := $image.Fill "220x220 Center"}}
<a href="{{ .RelPermalink }}">
<img src="{{ $resized.RelPermalink }}" alt="{{ .RenderString .Title }}" />
</a>
</div>
<div class="details">
<div class="info">
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>
</div>
<h2 title="{{ .RenderString .Title }}"><a href="{{ .RelPermalink }}">{{ .RenderString .Title }}</a></h2>
<div class="text">
{{ .Content | truncate 280 }}
</div>
</div>
</div>
{{ end }}
{{ range $others }}
<div class="post ">
<div class="picture">
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
{{ if $image }}
{{ $resized := $image.Fill "100x100 Center"}}
<a href="{{ .RelPermalink }}">
<img src="{{ $resized.RelPermalink }}" alt="{{ .Title }}" />
</a>
{{ end }}
</div>
<div class="details">
<span><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time></span>
<h3 title="{{ .Title }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="text">
{{ .Content | truncate 200 }}
</div>
</div>
</div>
{{ end }}
</div>
<div class="opening">
{{ .Content }}
</div>
</div>
</div>
{{ end }}