From 6cbcc7b6f79ac46f197547a1bafe5883d29286cc Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Sat, 13 Sep 2025 20:35:50 +0000 Subject: [PATCH] Update gallery page Signed-off-by: Nikolaos Karaolidis --- assets/sass/list.scss | 4 +- assets/sass/photoswipe.scss | 12 +--- layouts/partials/components/image/index.html | 55 ++++--------------- layouts/partials/components/image/list.html | 31 +++++++++++ .../partials/components/image/process.html | 41 ++++++++++++++ layouts/partials/gallery/list.html | 33 +---------- 6 files changed, 89 insertions(+), 87 deletions(-) create mode 100644 layouts/partials/components/image/list.html create mode 100644 layouts/partials/components/image/process.html diff --git a/assets/sass/list.scss b/assets/sass/list.scss index 556222e..7fa16c3 100644 --- a/assets/sass/list.scss +++ b/assets/sass/list.scss @@ -2,11 +2,11 @@ .post { display: block; - >a { + > a { color: inherit; } - >a:hover { + > a:hover { color: var(--text-800); } diff --git a/assets/sass/photoswipe.scss b/assets/sass/photoswipe.scss index 1fab5e5..8676f8e 100644 --- a/assets/sass/photoswipe.scss +++ b/assets/sass/photoswipe.scss @@ -18,20 +18,12 @@ position: fixed; bottom: 0; width: 100%; - height: 5rem; + height: auto; padding: 1rem 2rem; text-align: center; line-height: 1.5rem; .meta { - font-size: 0.7rem; - } - - a { - color: inherit; - } - - a:hover { - color: var(--text-800); + margin: 0; } } diff --git a/layouts/partials/components/image/index.html b/layouts/partials/components/image/index.html index 12c0050..6b3d2c6 100644 --- a/layouts/partials/components/image/index.html +++ b/layouts/partials/components/image/index.html @@ -1,58 +1,27 @@ {{- $page := .page -}} {{- $image := .image -}} -{{- $src := $image -}} -{{- $caption := "" -}} -{{- $title := "" -}} -{{- $alt := "" -}} - -{{- if reflect.IsMap $image -}} - {{- $src = $image.src | default "" -}} - {{- $caption = $image.caption | default "" -}} - {{- $title = $image.title | default $caption | default "" | plainify -}} - {{- $alt = $image.alt | default $title | default "" | plainify -}} -{{- end -}} - -{{- if $src -}} - {{- $isRemote := strings.HasPrefix $src "http" -}} - - {{- if $isRemote -}} - {{- $remote := resources.GetRemote $src -}} - {{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}} - {{- else -}} - {{- $image = ($page.Resources.Get $src) | default (resources.Get $src) -}} - {{- end -}} -{{- end -}} - -{{- with $image -}} - {{ $full := . | images.Filter (images.Process "webp q90") }} - - {{ $thumb := . }} - {{- if gt .Width 2000 -}} - {{- $thumb = . | images.Filter (images.Process "resize 2000x webp q75") -}} - {{- else -}} - {{- $thumb = . | images.Filter (images.Process "webp q75") -}} - {{- end -}} - +{{- $data := partial "components/image/process.html" (dict "image" .image "page" .page) -}} +{{- with $data -}} diff --git a/layouts/partials/components/image/list.html b/layouts/partials/components/image/list.html new file mode 100644 index 0000000..c45771f --- /dev/null +++ b/layouts/partials/components/image/list.html @@ -0,0 +1,31 @@ +{{- $page := .page -}} +{{- $image := .image -}} + +{{- $data := partial "components/image/process.html" (dict "image" .image "page" .page) -}} + +{{- with $data -}} +
+ + + +
+
+ {{ $page.Title }} + {{ partial "components/meta/index.html" $page }} +
+
+
+{{- end -}} diff --git a/layouts/partials/components/image/process.html b/layouts/partials/components/image/process.html new file mode 100644 index 0000000..6b9b1cc --- /dev/null +++ b/layouts/partials/components/image/process.html @@ -0,0 +1,41 @@ +{{- $image := .image -}} +{{- $page := .page -}} + +{{- $src := $image -}} +{{- $caption := "" -}} +{{- $title := "" -}} +{{- $alt := "" -}} + +{{- if reflect.IsMap $image -}} + {{- $src = $image.src | default "" -}} + {{- $caption = $image.caption | default "" -}} + {{- $title = $image.title | default $caption | default "" | plainify -}} + {{- $alt = $image.alt | default $title | default "" | plainify -}} +{{- end -}} + +{{- if $src -}} + {{- $isRemote := strings.HasPrefix $src "http" -}} + + {{- if $isRemote -}} + {{- $remote := resources.GetRemote $src -}} + {{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}} + {{- else -}} + {{- $image = ($page.Resources.Get $src) | default (resources.Get $src) -}} + {{- end -}} +{{- end -}} + +{{- $result := "" -}} +{{- with $image -}} + {{- $full := . | images.Filter (images.Process "webp q90") -}} + + {{- $thumb := . -}} + {{- if gt .Width 2000 -}} + {{- $thumb = . | images.Filter (images.Process "resize 2000x webp q75") -}} + {{- else -}} + {{- $thumb = . | images.Filter (images.Process "webp q75") -}} + {{- end -}} + + {{- $result = dict "full" $full "thumb" $thumb "caption" $caption "title" $title "alt" $alt -}} +{{- end -}} + +{{- return $result -}} diff --git a/layouts/partials/gallery/list.html b/layouts/partials/gallery/list.html index 458a410..e6d6553 100644 --- a/layouts/partials/gallery/list.html +++ b/layouts/partials/gallery/list.html @@ -2,38 +2,7 @@
{{ range sort .Pages "Date" "desc" }} {{ if not .Params.private }} - {{ $page := . }} - {{ $imageData := partial "components/image/reflect.html" .Params.hero }} - {{ with $imageData.image }} -
- - - -
-
- {{ upper $page.Title }} -
- {{ $page.Date | time.Format ":date_medium" }} - · - View Post -
-
-
-
- {{ end }} + {{ partial "components/image/list.html" (dict "page" . "image" .Params.hero) }} {{ end }} {{ end }}