优化一下博客的性能

This commit is contained in:
zqlit committed 2026-05-20 14:33:05 +08:00
1 parent 15421ff0ac
commit 427b17d7a0
24 files changed
+2045 -148

No files matched your search

@@ -1,10 +1,17 @@
{{ $src := .Destination }}
{{ $alt := .Text }}
{{ $width := "" }}
{{ $height := "" }}
{{ $srcset := "" }}
{{- if not (strings.HasPrefix $src "http") -}}
{{- $img := .Page.Resources.GetMatch $src -}}
{{- if $img -}}
{{- $src = $img.RelPermalink -}}
{{- $width = printf "%d" $img.Width -}}
{{- $height = printf "%d" $img.Height -}}
{{- else -}}
{{- $src = $src | relURL -}}
{{- end -}}
{{- end -}}
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-lazy-src="{{ $src }}" alt="{{ .Text }}" class="lazyload" uk-scrollspy="cls: uk-animation-fade; delay: 200">
<img src="{{ $src }}" alt="{{ $alt }}" class="lazyload lazy-loaded" loading="lazy" decoding="async"{{ with $width }} width="{{ . }}"{{ end }}{{ with $height }} height="{{ . }}"{{ end }}>