Skip to content

Commit

Permalink
do not lazy load the feature image
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Nov 26, 2023
1 parent 6eb34e7 commit 171cdba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{ $img = resources.Get $path }}
{{ end -}}

{{/* https://github.com/gohugoio/hugo/pull/10666/files */}}
{{/* https://github.com/gohugoio/hugo/pull/10666 */}}
{{- $params := $url.Query -}}
{{- $x2Param := $params.Get "2x" -}}
{{- $x2 := false -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
<div class="prose">
{{ $altText := $.Params.featureAlt | default $.Params.coverAlt | default "" }}
{{ $class := "mb-6 -mt-4 rounded-md" }}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }}
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "lazy" false) }}
{{ with $.Params.coverCaption }}
<figcaption class="mb-6 -mt-3 text-center">{{ . | markdownify }}</figcaption>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/picture.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ $lazy := .lazy }}
{{ $webp := .webp }}
{{ $lqip := .lqip }}
{{ $x2 := .x2 | default false }}
{{ $x2 := .x2 }}

{{ with $img }}
{{ if (eq .MediaType.SubType "svg") }}
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/pictureDefaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{{ $alt := .alt }}
{{ $class := .class }}
{{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }}
{{ if isset . "lazy" }}
{{ $lazy = .lazy }}
{{ end }}
{{ $webp := $.Page.Site.Params.enableImageWebp | default true }}
{{ $lqip := false }}
{{ $x2 := .x2 }}
Expand Down

0 comments on commit 171cdba

Please sign in to comment.