feat: Avancement général sur le contenu et le design
fixes #3, fixes #4, fixes #5, fixes #7, fixes #8, fixes #9, fixes #10
This commit is contained in:
30
layouts/partials/article-preview.html
Normal file
30
layouts/partials/article-preview.html
Normal file
@ -0,0 +1,30 @@
|
||||
{{ $isBig := default false (.Scratch.Get "big") }}
|
||||
{{ $title := .RenderString .Title }}
|
||||
{{ $titleWithoutHTML := $title | plainify }}
|
||||
{{ $pictureSize := cond $isBig "220x220 Center" "100x100 Center" }}
|
||||
{{ $truncateSize := cond $isBig 180 90}}
|
||||
<div class="post{{ if $isBig }} big{{ end }}">
|
||||
<div class="picture">
|
||||
{{ $image := .Resources.GetMatch (default "*" .Params.image) }}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{ if $image }}
|
||||
{{ $resized := $image.Fill $pictureSize}}
|
||||
<img src="{{ $resized.RelPermalink }}" alt="{{ $titleWithoutHTML }}" />
|
||||
{{ end }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="details">
|
||||
<small>
|
||||
<time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>
|
||||
</small>
|
||||
{{ if $isBig }}
|
||||
<h2 title="{{ $titleWithoutHTML }}"><a href="{{ .RelPermalink }}">{{ $title }}</a></h2>
|
||||
{{else}}
|
||||
<h3 title="{{ $titleWithoutHTML }}"><a href="{{ .RelPermalink }}">{{ $title }}</a></h3>
|
||||
{{ end }}
|
||||
<div class="text">
|
||||
{{ $ellipsis := print " <a href='" .RelPermalink "'>…</a>" | safeHTML }}
|
||||
{{ .Content | plainify | htmlUnescape | truncate $truncateSize $ellipsis }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user