Skip to content

Commit

Permalink
Merge branch 'main' into XhmikosR-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Mar 25, 2024
2 parents b01a595 + 67c3094 commit 9e6225c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="posts">
{{ $paginator := .Paginate (where site.RegularPages "Type" "posts") -}}
{{- range $i, $page := $paginator.Pages -}}
{{- /* Don't lazyload the first video in each page */ -}}
{{- /* Don't lazyload the first asset in each page (video, banner etc) */ -}}
{{- $lazyload := cond (eq $i 0) false true -}}

<div class="post">
Expand All @@ -18,7 +18,7 @@ <h1 class="post-title fw-semibold">
{{- end }}

{{ if .Page.Params.banner -}}
{{- partial "banner" (dict "context" .) -}}
{{- partial "banner" (dict "context" . "lazyload" $lazyload) -}}
{{- end }}

{{ .Content }}
Expand Down
3 changes: 2 additions & 1 deletion src/layouts/partials/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
{{- $src := .context.Page.Params.banner -}}
{{- $config := imageConfig (path.Join "/src/static" $src) -}}
{{- $classes := "d-block img-fluid rounded-3 mb-4" -}}
{{- $lazyload := .lazyload -}}

<img src="{{ $src }}" class="{{ $classes }}" alt="" width="{{ $config.Width }}" height="{{ $config.Height }}" loading="lazy">
<img src="{{ $src }}" class="{{ $classes }}" alt="" width="{{ $config.Width }}" height="{{ $config.Height }}"{{ if eq .lazyload true }} loading="lazy"{{ end }}>

0 comments on commit 9e6225c

Please sign in to comment.