initial commit
This commit is contained in:
23
themes/gallery/layouts/partials/featured.html
Normal file
23
themes/gallery/layouts/partials/featured.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{{ range where site.Pages.ByDate.Reverse "Params.featured" "=" true | first 1 }}
|
||||
{{ $gallery := partial "get-gallery.html" . }}
|
||||
{{ if $gallery }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ $featured := ($images.GetMatch (.Params.featured_image | default "*feature*")) | default (index $images 0) }}
|
||||
{{ $thumbnail := $featured.Filter (slice images.AutoOrient (images.Process "fit 1600x1600")) }}
|
||||
{{ $color := index $thumbnail.Colors 0 | default "transparent" }}
|
||||
<section class="featured">
|
||||
<a class="featured-card" href="{{ .RelPermalink }}" style="background-color: {{ $color }}; background-image: url({{ $thumbnail.RelPermalink }})">
|
||||
<div>
|
||||
<h2>{{ .Title }}</h2>
|
||||
<p>
|
||||
{{ if gt $gallery.albumCount 0 }}
|
||||
{{ T "albumCount" (dict "count" ($gallery.albumCount | lang.FormatNumber 0) "photoCount" ($gallery.imageCount | lang.FormatNumber 0 | lang.Translate "photoCount")) }}
|
||||
{{ else }}
|
||||
{{ T "photoCount" ($gallery.imageCount | lang.FormatNumber 0) }}
|
||||
{{ end }}
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</section>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user