From 09da20da8cad89350be6179c284c17d8a1f84d6f Mon Sep 17 00:00:00 2001 From: Derek Severin Date: Sun, 10 Feb 2019 13:41:12 +0700 Subject: Image gallery: changed 'gallery' shortcode to partial --- layouts/_default/single.html | 11 +++++ layouts/partials/gallery.html | 84 +++++++++++++++++++++++++++++++++ layouts/partials/load-photoswipe.html | 77 ++++++++++++++++++++++++++++++ layouts/shortcodes/figure.html | 29 ------------ layouts/shortcodes/gallery.html | 53 --------------------- layouts/shortcodes/load-photoswipe.html | 77 ------------------------------ 6 files changed, 172 insertions(+), 159 deletions(-) create mode 100644 layouts/partials/gallery.html create mode 100644 layouts/partials/load-photoswipe.html delete mode 100644 layouts/shortcodes/figure.html delete mode 100644 layouts/shortcodes/gallery.html delete mode 100644 layouts/shortcodes/load-photoswipe.html diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d7172ea..566fdf7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -42,6 +42,17 @@ {{ end }} */}} +{{/* +- "dir" .Params.images_directory + => if not defined: "images" +- "static" .Params.images_static + => if not defined: N/A +- "thumb" .Params.images_thumb_suffix + => if not defined: N/A +... +*/}} +{{ partial "gallery.html" (dict "page" . "dir" "images") }} +{{ partial "load-photoswipe.html" (dict "page" .) }} {{ end }} {{ define "lists" }} diff --git a/layouts/partials/gallery.html b/layouts/partials/gallery.html new file mode 100644 index 0000000..72e11d2 --- /dev/null +++ b/layouts/partials/gallery.html @@ -0,0 +1,84 @@ + + + + +{{- if not (.page.Scratch.Get "figurecount") }}{{ end }} +{{- .page.Scratch.Add "figurecount" 1 }} +{{ $baseURL := .page.Site.BaseURL }} + diff --git a/layouts/partials/load-photoswipe.html b/layouts/partials/load-photoswipe.html new file mode 100644 index 0000000..d9921b1 --- /dev/null +++ b/layouts/partials/load-photoswipe.html @@ -0,0 +1,77 @@ + + + +{{ if not (.page.Scratch.Get "photoswipeloaded") }} + {{ .page.Scratch.Set "photoswipeloaded" 1 }} + + + + + + + + + + + +{{ end }} \ No newline at end of file diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html deleted file mode 100644 index 4c6ff1f..0000000 --- a/layouts/shortcodes/figure.html +++ /dev/null @@ -1,29 +0,0 @@ - - -{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} -{{- $.Page.Scratch.Add "figurecount" 1 -}} - -{{- $thumb := .Get "src" | default (printf "%s." (.Get "thumb") | replace (.Get "link") ".") }} -
-
-
- -
- {{ with .Get "link" | default (.Get "src") }}{{ end }} - {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} -
- {{- with .Get "title" }}

{{.}}

{{ end }} - {{- if or (.Get "caption") (.Get "attr")}} -

- {{- .Get "caption" -}} - {{- with .Get "attrlink"}}{{ .Get "attr" }}{{ else }}{{ .Get "attr"}}{{ end -}} -

- {{- end }} -
- {{- end }} -
-
diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html deleted file mode 100644 index ab8671b..0000000 --- a/layouts/shortcodes/gallery.html +++ /dev/null @@ -1,53 +0,0 @@ - - -{{- if not ($.Page.Scratch.Get "figurecount") }}{{ end }} -{{- $.Page.Scratch.Add "figurecount" 1 }} -{{ $baseURL := .Site.BaseURL }} - diff --git a/layouts/shortcodes/load-photoswipe.html b/layouts/shortcodes/load-photoswipe.html deleted file mode 100644 index b4dc61c..0000000 --- a/layouts/shortcodes/load-photoswipe.html +++ /dev/null @@ -1,77 +0,0 @@ - - - -{{ if not ($.Page.Scratch.Get "photoswipeloaded") }} - {{ $.Page.Scratch.Set "photoswipeloaded" 1 }} - - - - - - - - - - - -{{ end }} \ No newline at end of file -- cgit v1.2.3