diff --git a/layouts/shortcodes/carousel.html b/layouts/shortcodes/carousel.html index 9f3cd004..3bf6b42c 100644 --- a/layouts/shortcodes/carousel.html +++ b/layouts/shortcodes/carousel.html @@ -3,20 +3,19 @@ {{ $aspectx := default "16" (index $aspect 0) }} {{ $aspecty := default "9" (index $aspect 1) }} {{ $interval := default "2000" (.Get "interval") }} -{{ $imagesParam := .Get "images" }} -{{ $items := slice }} {{ $page := .Page.Resources }} -{{ $imagesTemp := $imagesParam }} +{{ $imagesTemp := .Get "images" }} {{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }} {{ $imagesTemp = strings.TrimSuffix "}" $imagesTemp }} {{ $imagesTemp := strings.Split $imagesTemp "," }} +{{ $images := slice }} {{ range $imagesTemp }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} - {{ $items = $items | append (dict "resource" (resources.GetRemote .) "key" .) }} + {{ $images = $images | append (dict "resource" (resources.GetRemote .) "key" .) }} {{ else }} {{ range ($page.Match .) }} - {{ $items = $items | append (dict "resource" . "key" .Name) }} + {{ $images = $images | append (dict "resource" . "key" .Name) }} {{ end }} {{ end }} {{ end }} @@ -47,7 +46,7 @@ class="absolute right-0 bottom-0 left-0 z-2 mx-[15%] mb-10 flex list-none justify-center p-0" data-twe-carousel-indicators> {{ $num := 0 }} - {{ range $items }} + {{ range $images }}