Skip to content

Commit

Permalink
fix: do not count cover images for nodes (fixes #53)
Browse files Browse the repository at this point in the history
Images on on-leaf pages (nodes) are only shown as cover images and thus should not be added to the image count.
  • Loading branch information
nicokaiser committed Mar 26, 2024
1 parent fc12ec5 commit 7cfcb08
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions layouts/partials/get-gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
{{ $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 := len $images }}
{{ $imageCount := 0 }}
{{ $albumCount := 0 }}
{{ if .IsSection }}
{{ if .IsPage }}
{{ $imageCount = len $images }}
{{ else }}
{{ range where .RegularPagesRecursive "Params.private" "ne" true }}
{{ $albumCount = add $albumCount 1 }}
{{ $imageCount = add $imageCount (len (.Resources.ByType "image")) }}
Expand Down

0 comments on commit 7cfcb08

Please sign in to comment.