initial commit
This commit is contained in:
26
themes/gallery/layouts/partials/get-gallery.html
Normal file
26
themes/gallery/layouts/partials/get-gallery.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{{ $gallery := "" }}
|
||||
{{ $images := .Resources.ByType "image" }}
|
||||
{{ if gt (len $images) 0 }}
|
||||
{{ $featured := ($images.GetMatch (.Params.featured_image | default "*feature*")) | default (index $images 0) }}
|
||||
{{ $thumbnail := $featured.Filter (slice images.AutoOrient (images.Process "fit 600x600")) }}
|
||||
{{ $color := index $thumbnail.Colors 0 | default "transparent" }}
|
||||
{{ $imageCount := 0 }}
|
||||
{{ $albumCount := 0 }}
|
||||
{{ if .IsPage }}
|
||||
{{ $imageCount = len $images }}
|
||||
{{ else }}
|
||||
{{ range where .RegularPagesRecursive "Params.private" "ne" true }}
|
||||
{{ $albumCount = add $albumCount 1 }}
|
||||
{{ $imageCount = add $imageCount (len (.Resources.ByType "image")) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $gallery = dict
|
||||
"page" $
|
||||
"images" $images
|
||||
"thumbnail" $thumbnail
|
||||
"color" $color
|
||||
"albumCount" $albumCount
|
||||
"imageCount" $imageCount
|
||||
}}
|
||||
{{ end }}
|
||||
{{ return $gallery }}
|
||||
Reference in New Issue
Block a user