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..442b894 100644 --- a/assets/sass/photoswipe.scss +++ b/assets/sass/photoswipe.scss @@ -18,13 +18,13 @@ 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; + margin: 0; } a { diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index ab9646a..9aecd77 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,7 +1,3 @@ -{{ partial "components/image/index.html" (dict "page" .Page "image" (dict - "src" .Destination - "caption" .Text - "alt" .Title - )) -}} +{{ $data := partial "components/image/process.html" (dict "page" .Page "src" .Destination) }} +{{ partial "components/image/index.html" (merge $data (dict "caption" .Text "alt" .Title)) }} {{- /* chomp trailing newline */ -}} diff --git a/layouts/partials/components/hero/index.html b/layouts/partials/components/hero/index.html index 8d642cd..28f47f8 100644 --- a/layouts/partials/components/hero/index.html +++ b/layouts/partials/components/hero/index.html @@ -1,5 +1,8 @@

{{ .Title }}

{{ partial "components/meta/index.html" . }} - {{ partial "components/image/index.html" (dict "page" .Page "image" .Params.hero) }} + + {{ $hero := partial "components/hero/process.html" .Params.hero }} + {{ $data := partial "components/image/process.html" (dict "page" .Page "src" $hero.src) }} + {{ partial "components/image/index.html" (merge $data $hero) }}
diff --git a/layouts/partials/components/hero/process.html b/layouts/partials/components/hero/process.html new file mode 100644 index 0000000..d25da28 --- /dev/null +++ b/layouts/partials/components/hero/process.html @@ -0,0 +1,15 @@ +{{- $src := "" -}} +{{- $caption := "" -}} +{{- $title := "" -}} +{{- $alt := "" -}} + +{{- if reflect.IsMap . -}} + {{- $src = .src -}} + {{- $caption = .caption | default "" -}} + {{- $title = .title | default $caption | plainify -}} + {{- $alt = .alt | default $title | plainify -}} +{{- else -}} + {{- $src = . -}} +{{- end -}} + +{{- return (dict "src" $src "caption" $caption "title" $title "alt" $alt) -}} diff --git a/layouts/partials/components/image/index.html b/layouts/partials/components/image/index.html index 12c0050..1907149 100644 --- a/layouts/partials/components/image/index.html +++ b/layouts/partials/components/image/index.html @@ -1,59 +1,26 @@ -{{- $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 -}} +{{- $caption := .caption | default "" -}} +{{- $title := .title | default $caption | plainify -}} +{{- $alt := .alt | default $title | plainify -}} - -{{- end -}} + diff --git a/layouts/partials/components/image/process.html b/layouts/partials/components/image/process.html new file mode 100644 index 0000000..70bb8c2 --- /dev/null +++ b/layouts/partials/components/image/process.html @@ -0,0 +1,23 @@ +{{- $page := .page -}} +{{- $src := .src -}} + +{{- $original := "" -}} + +{{- $isRemote := strings.HasPrefix $src "http" -}} +{{- if $isRemote -}} + {{- $remote := resources.GetRemote $src -}} + {{- $original = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}} +{{- else -}} + {{- $original = ($page.Resources.Get $src) | default (resources.Get $src) -}} +{{- end -}} + +{{- $full := $original | images.Filter (images.Process "webp q90") -}} + +{{- $thumb := "" -}} +{{- if gt $original.Width 2000 -}} + {{- $thumb = $original | images.Filter (images.Process "resize 2000x webp q75") -}} +{{- else -}} + {{- $thumb = $original | images.Filter (images.Process "webp q75") -}} +{{- end -}} + +{{- return (dict "original" $original "full" $full "thumb" $thumb) -}} diff --git a/layouts/partials/gallery/list.html b/layouts/partials/gallery/list.html index 458a410..f45e867 100644 --- a/layouts/partials/gallery/list.html +++ b/layouts/partials/gallery/list.html @@ -2,38 +2,38 @@
{{ 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 -
-
+ {{ $hero := partial "components/hero/process.html" .Params.hero }} + {{ $data := partial "components/image/process.html" (dict "page" . "src" $hero.src) }} + + {{- $caption := .Title -}} + {{- $title := $hero.title | default $caption | plainify -}} + {{- $alt := $hero.alt | default $title | plainify -}} + + +
+ + + +
+
+ {{ $caption }} + {{ partial "components/meta/index.html" . }}
- {{ end }} +
{{ end }} {{ end }}