Skip to content

Commit

Permalink
Add configuration flag
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Sep 12, 2023
1 parent 759982f commit 86dd657
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ autoSwitchAppearance = true
enableSearch = true
enableCodeCopy = true
enableImageLazyLoading = true
enableWebp = true

# robots = ""
fingerprintAlgorithm = "sha256"
Expand Down
3 changes: 2 additions & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{ $altText := .Text }}
{{ $caption := .Title }}
{{ $lazyLoad := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ $webp := $.Page.Site.Params.enableWebp | default true }}
{{ if findRE "^https?" $url.Scheme }}
<figure>
<img
Expand All @@ -24,7 +25,7 @@
{{ with $resource }}
<figure>
<picture>
{{ if ne .MediaType.SubType "svg" }}
{{ if (and (ne .MediaType.SubType "svg") $webp) }}
<source
{{ if lt .Width 660 }}
{{ with .Resize (printf "%dx%d webp" .Width .Height) }}
Expand Down

0 comments on commit 86dd657

Please sign in to comment.