From 07f46720f8b83c3517a1448a0e109c6ba43c4a63 Mon Sep 17 00:00:00 2001 From: Hoernschen Date: Mon, 15 Jan 2024 22:55:39 +0100 Subject: [PATCH] FIX theme toggler CHANGE image optimization ADD custom markdown image rendering --- assets/build/images.sh | 4 +-- assets/scss/index.scss | 19 ++++++++-- layouts/_default/_markup/render-image.html | 15 ++++++++ layouts/_default/single.html | 7 ---- layouts/partials/components/image.html | 5 ++- layouts/partials/head.html | 2 -- layouts/partials/header.html | 2 +- layouts/partials/hero.html | 2 +- static/js/index.js | 41 ++++++++++++++++++++++ static/js/scroll.js | 16 --------- static/js/theme.js | 27 -------------- 11 files changed, 81 insertions(+), 59 deletions(-) create mode 100644 layouts/_default/_markup/render-image.html delete mode 100644 static/js/scroll.js delete mode 100644 static/js/theme.js diff --git a/assets/build/images.sh b/assets/build/images.sh index 515e623..9689030 100755 --- a/assets/build/images.sh +++ b/assets/build/images.sh @@ -15,7 +15,7 @@ shopt -s globstar # Resize sizes=(320 640 960 1280) -for FILE in static/**/*.@(jpg|jpeg|tif|tiff|png|gif); do +for FILE in public/**/*.@(jpg|jpeg|tif|tiff|png|gif); do DIR=$(dirname "$FILE") NAME=$(basename "$FILE" | cut -d. -f1) EXTENSION=$(basename "$FILE" | cut -d. -f2) @@ -25,7 +25,7 @@ for FILE in static/**/*.@(jpg|jpeg|tif|tiff|png|gif); do done # Web Optimized Formats -for FILE in static/**/*.@(jpg|jpeg|tif|tiff|png|gif); do +for FILE in public/**/*.@(jpg|jpeg|tif|tiff|png|gif); do convert $PARAMS "$FILE" "${FILE}".webp; convert $PARAMS "$FILE" "${FILE}".avif; done \ No newline at end of file diff --git a/assets/scss/index.scss b/assets/scss/index.scss index dd4e0a9..669108f 100644 --- a/assets/scss/index.scss +++ b/assets/scss/index.scss @@ -161,6 +161,13 @@ a { z-index: 10; } +#theme-toggler { + border: none; + background: inherit; + color: {{ .Site.Params.color.secondary }}; + cursor: pointer; +} + /* Footer */ .footer { @@ -365,7 +372,7 @@ main > .content { } .hero > .content > .image { - max-width: 200px; + max-width: 150px; } .hero > .description { @@ -397,7 +404,7 @@ main > .content { border-bottom: 3px solid {{ .Site.Params.color.primary }}; } -.hero > .content > div { +.hero > .content > .heading { flex-grow: 1; display: flex; flex-direction: column; @@ -473,10 +480,18 @@ img { height: auto; margin: auto; object-fit: contain; + border-radius: 6px; } .avatar { border-radius: 50%; border: 3px solid {{ .Site.Params.color.primary }}; object-fit: cover; +} + +.caption { + text-align: center; + color: gray; + font-size: small; + margin: 0px; } \ No newline at end of file diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..debb86f --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,15 @@ +{{ $caption := .Title }} +{{ $alt := .Text }} + +{{ $img := .Page.Resources.GetMatch .Destination }} +{{ if not $img }} + {{ $img = resources.Get .Destination }} + {{ if not $img }} + {{ $img := resources.GetRemote .Destination | resources.Copy (path.Join "images" (path.Base .Destination)) }} + {{ end }} +{{ end }} + +{{ with $img }} + {{ partial "components/image.html" (dict "url" .RelPermalink "alt" $alt "width" .Width "height" .Height) }} +

{{ $caption }}

+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 6a1c401..2400692 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,11 +1,4 @@ {{ define "main" }} - {{ with .Params.image }} - {{ if .url }} - {{ .alt }} - {{ else }} - - {{ end }} - {{ end }}
{{ with .Title }}
diff --git a/layouts/partials/components/image.html b/layouts/partials/components/image.html index a933517..fb76fee 100644 --- a/layouts/partials/components/image.html +++ b/layouts/partials/components/image.html @@ -1,5 +1,5 @@