Skip to content

Commit

Permalink
feat: add the modern_format parameter
Browse files Browse the repository at this point in the history
When it is set as webp then the image will be resized in webp format
  • Loading branch information
razonyang committed Sep 16, 2023
1 parent 8174fcc commit e5bd847
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/hb/modules/background-image/scss/variables.tmpl.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
$hb-background-img: '';
{{- with resources.GetMatch "images/background.*" }}
{{- $bg := .Resize "1920x1080" }}
{{- $resize := "1920x1080" }}
{{- if and
(eq $.params.hb.background_image.modern_format "webp")
(ne .MediaType.SubType "webp")
}}
{{- $resize = printf "%s webp" $resize }}
{{- end }}
{{- $bg := .Resize $resize }}
{{- with index $.params.hb.background_image "brightness" }}
{{- $bg = $bg.Filter (images.Brightness .) }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ path = "github.com/hbstack/hb"

[params.hb.background_image]
brightness = 0
modern_format = "webp"

0 comments on commit e5bd847

Please sign in to comment.