From d5a280a98aee2425ab2423139db66e4c11d24c01 Mon Sep 17 00:00:00 2001 From: Spedon Date: Tue, 14 Mar 2023 23:30:24 +0800 Subject: [PATCH] separate overlay.html --- layouts/index.html | 25 ++++++++++++++++--------- layouts/partials/overlay.html | 6 ++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 layouts/partials/overlay.html diff --git a/layouts/index.html b/layouts/index.html index e41f9d3..bdb6418 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -3,19 +3,14 @@ - {{- partial "head.html" . -}} + {{ partial "head.html" . }} {{ .Title }}
- {{- partial "header.html" . -}} + {{ partial "header.html" . }}
-
-
-
-
-
-
+{{ partial "overlay.html" . }}
{{ $sourcePath := "images" }} {{ $gallery := site.GetPage $sourcePath }} @@ -24,7 +19,19 @@ {{ $.Scratch.Add "img" slice }} {{ range . }} {{ $index = sub $index 1}} - {{ $.Scratch.Add "img" (dict "index" (string $index) "url" (string .RelPermalink) "imgH" (string .Height) "imgW" (string .Width)) }} + {{ $colors := .Colors }} + {{ $pColor := index $colors 0 }} + {{ $sColor := "#ccc" }} + {{ if gt (len $colors) 1 }} + {{ $sColor = index $colors 1 }} + {{ end }} + {{ $.Scratch.Add "img" (dict + "index" (string $index) + "url" (string .RelPermalink) + "imgH" (string .Height) + "imgW" (string .Width) + "pColor" (string $pColor) + "sColor" (string $sColor)) }} {{ end }} {{ end }} diff --git a/layouts/partials/overlay.html b/layouts/partials/overlay.html new file mode 100644 index 0000000..b577df3 --- /dev/null +++ b/layouts/partials/overlay.html @@ -0,0 +1,6 @@ +
+
+
+
+
+
\ No newline at end of file