优化一下博客的性能
This commit is contained in:
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 }}>
|
||||
@@ -6,7 +6,7 @@
|
||||
{{ range $paginator.Pages }}
|
||||
<div class="post">
|
||||
<div class="time">{{ .Date.Format "January 2, 2006" }}</div>
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -90,6 +90,5 @@
|
||||
{{ end }}
|
||||
<!-- 评论区内容结束 -->
|
||||
</div>
|
||||
<script async src="/js/bsz.js"></script>
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in new issue
Block a user