mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
* feat: refactor image retrieval logic and improve variable initialization - Add a new file `layouts/partials/function/getImageSlice.html` - Initialize variables `$context`, `$Path`, and `$params` - Set `$Path` based on the result of the `partial/function/currentMenuItem.html` partial - Retrieve the page `$gallery` based on `$Path` - Return all resources of type `image` from `$gallery` * refactor: adapt getImageSlice function to `single.json` * feat: refactor navigation UI components to use static go template * feat: update navigation functionality and threshold rendering
32 lines
998 B
JSON
32 lines
998 B
JSON
{{- $context := . -}}
|
|
{{- $params := .Page.Params | merge .Site.Params.Page -}}
|
|
|
|
{{- with partial "function/getImageSlice.html" . -}}
|
|
{{- $index := len . -}}
|
|
{{- $context.Scratch.Add "img" slice -}}
|
|
{{- range sort . "Name" "desc" -}}
|
|
{{- $image := . -}}
|
|
{{- $index = sub $index 1 -}}
|
|
{{- $alt := .Name -}}
|
|
{{- with $params.unifiedAlt -}}
|
|
{{- $alt = . -}}
|
|
{{- end -}}
|
|
{{- $lores := .Resize (site.Params.loResOpt | default "700x webp Lanczos q60") -}}
|
|
{{- $hires := .Resize (site.Params.hiResOpt | default "2000x webp Lanczos q75") -}}
|
|
{{- $context.Scratch.Add "img" (dict
|
|
"index" (int $index)
|
|
"alt" (string $alt)
|
|
"loUrl" (string $lores.RelPermalink)
|
|
"loImgH" (int $lores.Height)
|
|
"loImgW" (int $lores.Width)
|
|
"hiUrl" (string $hires.RelPermalink)
|
|
"hiImgH" (int $hires.Height)
|
|
"hiImgW" (int $hires.Width)
|
|
)
|
|
-}}
|
|
{{- end -}}
|
|
{{ $context.Scratch.Get "img" | jsonify }}
|
|
{{- else -}}
|
|
[]
|
|
{{- end -}}
|