diff --git a/themes/neff/layouts/gallery/li.html b/themes/neff/layouts/gallery/li.html index 21c256d..5157d0b 100755 --- a/themes/neff/layouts/gallery/li.html +++ b/themes/neff/layouts/gallery/li.html @@ -1,12 +1,22 @@ {{- $ctx := . -}} {{- $page := (index .Pages 0) -}} {{- $image := "" -}} +{{- $images := slice -}} {{- with $page -}} -{{- $image = index ($page.Resources.ByType "image") 0 }} +{{- $images = $page.Resources.ByType "image" }} {{- else -}} -{{- $image = index (.Resources.ByType "image") 0 -}} +{{- $images = .Resources.ByType "image" -}} {{- end -}} -{{ with $image }} +{{- range $images -}} + {{ if .Params.featured }} + {{ $image = . }} + {{ end }} +{{ end }} +{{ if $image }} +{{ else }} + {{ $image = index $images 0 }} +{{ end }} +{{ with $images }}
  • {{- partial "figure.html" (dict "ctx" $ctx "image" $image "class" "gallery" "showTitle" true "showDescription" true) -}}
  • {{ end }} diff --git a/themes/neff/layouts/partials/figure.html b/themes/neff/layouts/partials/figure.html index 93d257c..57187ed 100644 --- a/themes/neff/layouts/partials/figure.html +++ b/themes/neff/layouts/partials/figure.html @@ -2,11 +2,12 @@ {{- $alt := .ctx.Params.alt -}} {{- $description := .ctx.Params.description | markdownify -}} {{- $keep := .keepOriginal -}} +{{- $class := .class -}} {{- $href := .ctx.Params.href }}
    - {{- partial "img.html" (dict "image" .image "ctx" .ctx "keepOriginal" $keep) -}} + {{- partial "img.html" (dict "image" .image "ctx" .ctx "keepOriginal" $keep "class" $class) -}}
    {{- if .showTitle -}} diff --git a/themes/neff/layouts/partials/img.html b/themes/neff/layouts/partials/img.html index 270c659..86e4994 100644 --- a/themes/neff/layouts/partials/img.html +++ b/themes/neff/layouts/partials/img.html @@ -7,18 +7,23 @@ {{- with .ctx.Params.alt -}} {{- $alt = . -}} {{- end -}} +{{- with .class -}} + {{- $class := . -}} +{{- end -}} {{- $ctx := .ctx -}} {{ with .image }} +{{- $class := "" -}} {{ if eq $keep true }} {{ $alt }} {{ else }} {{- $imageSm := .Fill "300x300 Top" -}} {{- $imageMd := .Fill "500x500 Top" -}} {{ $alt }} diff --git a/themes/neff/layouts/shortcodes/gallery.html b/themes/neff/layouts/shortcodes/gallery.html index 15c3270..5145fd9 100644 --- a/themes/neff/layouts/shortcodes/gallery.html +++ b/themes/neff/layouts/shortcodes/gallery.html @@ -1,68 +1,52 @@ {{- $search := "**.jpg" -}} -{{ with .Get "search" -}} -{{- $search = . }} -{{- else -}} -{{- $search = .Get 0 -}} -{{- end -}} - {{- $keep := false -}} -{{- with .Get "original" -}} -{{- $keep = . }} -{{- else -}} -{{- $keep = .Get 3 -}} -{{- end -}} - -{{- if eq $keep "true" -}} -{{- $keep = true -}} -{{- else -}} -{{- $keep = false -}} -{{- end -}} - {{- $title := true -}} -{{- with .Get "title" -}} -{{- $title = . }} -{{- else -}} -{{- $title = .Get 1 -}} -{{- end -}} - -{{- if eq $title "false" -}} -{{- $title = false -}} -{{- else -}} -{{- $title = true -}} -{{- end -}} - {{- $description := true -}} -{{- with .Get "description" -}} -{{- $description = . }} -{{- else -}} -{{- $description = .Get 2 -}} -{{- end -}} - -{{- if eq $description "false" -}} -{{- $description = false -}} -{{- else -}} -{{- $description = true -}} -{{- end -}} - {{- $lightbox := true -}} -{{- with .Get "lightbox" -}} -{{- $lightbox = . }} +{{- if .IsNamedParams -}} + {{- with .Get "search" -}} + {{ $search = . }} + {{- end -}} + {{- with .Get "original" -}} + {{- $keep = . }} + {{- end -}} + {{- with .Get "title" -}} + {{ $title = . }} + {{- end -}} + {{- $description := true -}} + {{ with .Get "description" -}} + {{- end -}} + {{- with .Get "lightbox" -}} + {{ $lightbox = . }} + {{- end -}} {{- else -}} -{{- $lightbox = .Get 2 -}} -{{- end -}} - -{{- if eq $lightbox "false" -}} -{{- $lightbox = false -}} -{{- else -}} -{{- $lightbox = true -}} + {{- with .Get 0 -}} + {{ $search = . }} + {{- end -}} + {{- with .Get 1 -}} + {{ $title = . }} + {{- end -}} + {{- with .Get 2 -}} + {{ $description = . }} + {{- end -}} + {{- with .Get 3 -}} + {{ $keep = . }} + {{- end -}} + {{- with .Get 4 -}} + {{ $lightbox = . }} + {{- end -}} {{- end -}} \ No newline at end of file diff --git a/themes/neff/layouts/shortcodes/image.html b/themes/neff/layouts/shortcodes/image.html index c5e7cdc..944de65 100644 --- a/themes/neff/layouts/shortcodes/image.html +++ b/themes/neff/layouts/shortcodes/image.html @@ -1,2 +1,55 @@ -{{ $image := $.Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }} -{{ partial "figure.html" (dict "image" $image "ctx" $image "class" (.Get 1) "lightbox" true "showTitle" true "showDescription" true) }} \ No newline at end of file +{{ $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 }} +
  • +{{ end }} + {{ partial "figure.html" (dict "image" $image "ctx" $image "class" $class "lightbox" $lightbox "showTitle" $showTitle "showDescription" $showDescription) }} +{{ if $list }} +
  • +{{ end }} \ No newline at end of file