neff-steindesign.de/themes/neff/layouts/shortcodes/image.html

55 lines
1.1 KiB
HTML

{{ $search := "**.jpg" }}
{{ $class := "" }}
{{ $title := "" }}
{{ $alt := "" }}
{{ $description := "" }}
{{ $lightbox := true }}
{{ $showTitle := true }}
{{ $showDescription := true }}
{{ $list := false }}
{{ if .IsNamedParams }}
{{ with .Get "search" }}
{{ $search = .}}
{{ end }}
{{ with .Get "class" }}
{{ $class = .}}
{{ end }}
{{ with .Get "title" }}
{{ $title = .}}
{{ end }}
{{ with .Get "description" }}
{{ $description = .}}
{{ end }}
{{ with .Get "alt" }}
{{ $alt = .}}
{{ else }}
{{ $alt = $description}}
{{ end }}
{{ with .Get "lightbox" }}
{{ $lightbox = .}}
{{ end }}
{{ with .Get "showTitle" }}
{{ $showTitle = .}}
{{ end }}
{{ with .Get "showDescription" }}
{{ $showTitle = .}}
{{ end }}
{{ with .Get "list" }}
{{ $list = .}}
{{ end }}
{{ else }}
{{ with .Get 0 }}
{{ $search = . }}
{{ end }}
{{ with .Get 1 }}
{{ $class = . }}
{{ end }}
{{ end }}
{{ $image := $.Page.Resources.GetMatch $search }}
{{ if $list }}
<li class="col-xs-6 col-sm-4 padding">
{{ end }}
{{ partial "figure.html" (dict "image" $image "ctx" $image "class" $class "lightbox" $lightbox "showTitle" $showTitle "showDescription" $showDescription) }}
{{ if $list }}
</li>
{{ end }}