mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 00:12:09 +00:00
Templates: drop unused class, support img scaling
- The .footnote-ref class was unused, drop it. - Support supplying a scale-factor property to the picture shortcode, to upscale small images.
This commit is contained in:
parent
41b66d8ceb
commit
8be0fae481
2 changed files with 10 additions and 3 deletions
|
@ -7,8 +7,8 @@
|
|||
{{ $referencesWithHeading := printf `<section role="doc-endnotes" aria-labelledby="note-hd">
|
||||
<h2 id="note-hd">%s</h2>` ($heading) -}}
|
||||
|
||||
<!--Remove deprecated DPUB-ARIA role-->
|
||||
{{ $endnote := `(role="doc-endnote")` }}
|
||||
<!--Remove deprecated DPUB-ARIA role and unused classes-->
|
||||
{{ $endnote := `(role="doc-endnote"|class="footnote-ref")` }}
|
||||
{{ $noEndnote := printf "" }}
|
||||
|
||||
<!--Add tabindex to all <pre> elements, inc. those that aren't generated by Goldmark-->
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
{{ $dark_webp := resources.GetMatch (printf "/p/%s_dark.webp" (.Get "name")) -}}
|
||||
{{ $dark_avif := resources.GetMatch (printf "/p/%s_dark.avif" (.Get "name")) -}}
|
||||
{{ $dark_jxl := resources.GetMatch (printf "/p/%s_dark.jxl" (.Get "name")) -}}
|
||||
|
||||
{{- $img_width := $light_png.Width -}}
|
||||
{{- $img_height := $light_png.Height -}}
|
||||
{{- with (.Get "sf") -}}
|
||||
{{- $img_width = (mul $img_width . ) -}}
|
||||
{{- $img_height = (mul $img_height . ) -}}
|
||||
{{- end -}}
|
||||
<picture>
|
||||
{{ with $dark_svg -}}
|
||||
{{ $dark_svg_src := . | resources.Fingerprint "md5" -}}
|
||||
|
@ -73,7 +80,7 @@
|
|||
srcset="{{ $light_png_src.RelPermalink }}"
|
||||
type="image/png">
|
||||
<img
|
||||
width="{{ $light_png.Width }}" height="{{ $light_png.Height }}"
|
||||
width="{{ $img_width }}" height="{{ $img_height }}"
|
||||
src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}'
|
||||
decoding="async">
|
||||
</picture>{{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}}
|
||||
|
|
Loading…
Reference in a new issue