Add a badge to the photo list items that have multiple photos in them
This commit is contained in:
parent
baad04e7a4
commit
00d2e9263d
2 changed files with 39 additions and 2 deletions
|
@ -1,6 +1,11 @@
|
|||
{{- $thumbnail := partial "photos/thumbnail.html" (dict "Page" . "Width" 600 "Height" 600) -}}
|
||||
{{- $thumbnail = $thumbnail.Crop "600x600" -}}
|
||||
{{- $altText := $thumbnail.Params.alt -}}
|
||||
{{- $numberOfImages := len (partial "photos/list.html" .) -}}
|
||||
{{- $hasMultipleImages := gt $numberOfImages 1 -}}
|
||||
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
|
||||
{{ if $hasMultipleImages }}
|
||||
<div class="badge">{{ $numberOfImages }}</div>
|
||||
{{ end }}
|
||||
<img src="{{ $thumbnail.RelPermalink }}"{{ with $altText }} alt="{{ . }}"{{ end }}>
|
||||
</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue