mirror of https://github.com/jpanther/congo.git
add configuration option
parent
d37a633509
commit
afa25640c3
|
@ -13,6 +13,7 @@ enableSearch = true
|
||||||
enableCodeCopy = true
|
enableCodeCopy = true
|
||||||
enableImageLazyLoading = true
|
enableImageLazyLoading = true
|
||||||
enableWebp = true
|
enableWebp = true
|
||||||
|
enableLqip = true
|
||||||
|
|
||||||
# robots = ""
|
# robots = ""
|
||||||
fingerprintAlgorithm = "sha256"
|
fingerprintAlgorithm = "sha256"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
{{ $lazyLoad := .context.Page.Site.Params.enableImageLazyLoading | default true }}
|
{{ $lazyLoad := .context.Page.Site.Params.enableImageLazyLoading | default true }}
|
||||||
{{ $webp := .context.Page.Site.Params.enableWebp | default true }}
|
{{ $webp := .context.Page.Site.Params.enableWebp | default true }}
|
||||||
|
{{ $lqip := .context.Page.Site.Params.enableLqip | default true }}
|
||||||
|
|
||||||
{{ if findRE "^https?" $url.Scheme }}
|
{{ if findRE "^https?" $url.Scheme }}
|
||||||
<img
|
<img
|
||||||
|
@ -22,7 +23,7 @@
|
||||||
{{ $resource = resources.Get ($url.String) }}
|
{{ $resource = resources.Get ($url.String) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ with $resource }}
|
{{ with $resource }}
|
||||||
{{ if ne .MediaType.SubType "svg" }}
|
{{ if (and (ne .MediaType.SubType "svg") $lqip) }}
|
||||||
{{ $lqip := (.Resize "20x webp").Content | base64Encode }}
|
{{ $lqip := (.Resize "20x webp").Content | base64Encode }}
|
||||||
<picture
|
<picture
|
||||||
style="background: url(data:image/webp;base64,{{ $lqip }}); background-size: cover"
|
style="background: url(data:image/webp;base64,{{ $lqip }}); background-size: cover"
|
||||||
|
|
Loading…
Reference in New Issue