From b45a888a91ccbc5b309570bff6854d69524b1c85 Mon Sep 17 00:00:00 2001 From: Razon Yang Date: Sat, 13 Jan 2024 17:21:08 +0800 Subject: [PATCH] feat: add the img-grid shortcode (#105) --- layouts/partials/bootstrap/img-grid.html | 28 ++++++++++++++++++++++ layouts/shortcodes/bootstrap/img-grid.html | 1 + layouts/shortcodes/bs/img-grid.html | 1 + 3 files changed, 30 insertions(+) create mode 100644 layouts/partials/bootstrap/img-grid.html create mode 100644 layouts/shortcodes/bootstrap/img-grid.html create mode 100644 layouts/shortcodes/bs/img-grid.html diff --git a/layouts/partials/bootstrap/img-grid.html b/layouts/partials/bootstrap/img-grid.html new file mode 100644 index 0000000..872d138 --- /dev/null +++ b/layouts/partials/bootstrap/img-grid.html @@ -0,0 +1,28 @@ +{{- $key := "" }} +{{- if .IsNamedParams }} + {{- $key = .Get "data" }} +{{- else }} + {{- $key = .Get 0 }} +{{- end }} +{{- $data := partialCached "bootstrap/functions/data" (dict "key" $key "page" .Page) .Page $key }} +{{- with $data }} +
+ {{- range . }} + {{- $img := partial "images/image" (dict + "Filename" .src + "ClassName" "bs-img-grid-item-img" + "Alt" .title + "Caption" .title) + }} + {{- if .url }} + + {{ $img }} + + {{- else }} +
+ {{ $img }} +
+ {{- end }} + {{- end }} +
+{{- end }} diff --git a/layouts/shortcodes/bootstrap/img-grid.html b/layouts/shortcodes/bootstrap/img-grid.html new file mode 100644 index 0000000..35aa87d --- /dev/null +++ b/layouts/shortcodes/bootstrap/img-grid.html @@ -0,0 +1 @@ +{{ partial "bootstrap/img-grid" . }} diff --git a/layouts/shortcodes/bs/img-grid.html b/layouts/shortcodes/bs/img-grid.html new file mode 100644 index 0000000..35aa87d --- /dev/null +++ b/layouts/shortcodes/bs/img-grid.html @@ -0,0 +1 @@ +{{ partial "bootstrap/img-grid" . }}