52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
<a href="{{ .RelPermalink }}" class="card panel panel-hero">
|
|
{{ $page := . -}}
|
|
{{- $coverPath := .Params.cover -}}
|
|
{{- $img := false -}}
|
|
{{- if $coverPath -}}
|
|
{{- if strings.HasSuffix $coverPath ".yaml" -}}
|
|
{{- $coverAbsPath := printf "%s%s" $page.File.Dir $coverPath -}}
|
|
{{- $coverRaw := readFile $coverAbsPath -}}
|
|
{{- $coverData := $coverRaw | transform.Unmarshal -}}
|
|
{{- with $coverData.file -}}
|
|
{{- $img = $page.Resources.GetMatch . -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- $img = $page.Resources.GetMatch $coverPath -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- if $img -}}
|
|
{{- with $img -}}
|
|
{{- $resized := .Fill "450x220" -}}
|
|
<div class="card-image" style="background-image: url({{ $resized.RelPermalink }});"></div>
|
|
{{ end -}}
|
|
{{ else }}<div class="card-image"></div>
|
|
{{ end -}}
|
|
<div class="card-content">
|
|
<h3>{{ .Title }}</h3>
|
|
{{- if not $page.IsSection -}}
|
|
{{- with $page.Date -}}
|
|
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
|
|
{{- end -}}
|
|
{{- end -}}
|
|
<div class="card-meta">
|
|
{{ $section := "" -}}
|
|
{{- with .Parent -}}
|
|
{{- $sectionPath := path.Base .File.Dir -}}
|
|
{{- $section = $sectionPath -}}
|
|
{{- end -}}
|
|
<span class="section section-{{ $section }}">{{ .Parent.LinkTitle }}</span>
|
|
<span class="reading-time">
|
|
{{ if .IsSection -}}
|
|
{{- $count := len .Pages -}}
|
|
{{- $label := cond (eq $count 1) "article" "articles" -}}
|
|
{{- $count }} {{ $label -}}
|
|
{{- else -}}
|
|
{{- if ge .ReadingTime 5 -}}
|
|
{{- .ReadingTime }} min de lecture
|
|
{{- end -}}
|
|
{{- end }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</a>
|