mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
chore(imageJSON.html): add alt attribute to images in imageJSON partial to improve accessibility
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
{{- $Page := .Page -}}
|
||||
{{- $params := .Page.Params | merge .Site.Params.Page -}}
|
||||
|
||||
{{ $gallery := site.GetPage .Path }}
|
||||
{{ with $gallery.Resources.ByType "image" }}
|
||||
{{ $index := len . }}
|
||||
{{ $Page.Scratch.Add "img" slice }}
|
||||
{{ range . }}
|
||||
{{ $index = sub $index 1 }}
|
||||
{{ $lores := .Resize "800x webp Lanczos q60" }}
|
||||
{{ $hires := .Resize "2500x webp Lanczos q75" }}
|
||||
{{ $Page.Scratch.Add "img" (dict
|
||||
{{- $gallery := site.GetPage .Path -}}
|
||||
{{- with $gallery.Resources.ByType "image" -}}
|
||||
{{- $index := len . -}}
|
||||
{{- $Page.Scratch.Add "img" slice -}}
|
||||
{{- range sort . "Name" "desc" -}}
|
||||
{{- $image := . -}}
|
||||
{{- $index = sub $index 1 -}}
|
||||
{{- $alt := .Name -}}
|
||||
{{- with $params.unifiedAlt -}}
|
||||
{{- $alt = . -}}
|
||||
{{- end -}}
|
||||
{{- $lores := .Resize "800x webp Lanczos q60" -}}
|
||||
{{- $hires := .Resize "2500x webp Lanczos q75" -}}
|
||||
{{- $Page.Scratch.Add "img" (dict
|
||||
"index" (int $index)
|
||||
"alt" (string $alt)
|
||||
"loUrl" (string $lores.RelPermalink)
|
||||
"loImgH" (int $lores.Height)
|
||||
"loImgW" (int $lores.Width)
|
||||
@@ -17,7 +24,7 @@
|
||||
"hiImgH" (int $hires.Height)
|
||||
"hiImgW" (int $hires.Width)
|
||||
)
|
||||
}}
|
||||
-}}
|
||||
{{- end -}}
|
||||
<script id="imagesSource" type="application/json">{{ $Page.Scratch.Get "img" | jsonify | safeJS }}</script>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user