summaryrefslogtreecommitdiffstats
path: root/layouts/partials/GetIllustration.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--layouts/partials/GetIllustration.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/layouts/partials/GetIllustration.html b/layouts/partials/GetIllustration.html
new file mode 100644
index 0000000..1b21f3b
--- /dev/null
+++ b/layouts/partials/GetIllustration.html
@@ -0,0 +1,22 @@
+{{- $item := .item -}}
+{{- $illustration := "" -}}
+{{- $style := "img-wrap mx-auto mx-md-0" -}}
+{{- $size := .size | default "col-12 col-sm-4 col-lg-12" -}}
+
+{{ if $item.Params.icon }}
+ {{- $icon := (or (and (reflect.IsMap $item.Params.Icon) $item.Params.Icon.url) $item.Params.Icon) -}}
+ {{- $mode := and (reflect.IsMap $item.Params.Icon) $item.Params.Icon.mode -}}
+ {{ if eq (lower (path.Ext $icon)) ".json" }}
+ {{ $illustration = partial "assets/animation.html" (dict "data" $icon "mode" $mode "loop" false "hover" true "class" (printf "mx-auto text-center %s" $size)) }}
+ {{ else }}
+ {{ $illustration = partial "assets/icon.html" (dict "icon" "mode" $mode $icon "wrapper" "mx-auto text-center")}}
+ {{ end }}
+{{ else }}
+ {{- $thumbnail := "" -}}
+ {{ if reflect.IsMap $item.Params.Thumbnail }}{{ $thumbnail = $item.Params.Thumbnail.url }}{{ else }}{{ $thumbnail = $item.Params.Thumbnail }}{{ end }}
+ {{- if $thumbnail }}
+ {{ $illustration = partial "assets/image.html" (dict "url" $thumbnail "ratio" "16x9" "wrapper" $style "inner" "rounded" "title" $item.Site.Title) }}
+ {{ end }}
+{{ end }}
+
+{{ return $illustration }} \ No newline at end of file