Skip to content

Commit

Permalink
add lazy to item media and clean Scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
sebousan committed Oct 9, 2024
1 parent 02d6810 commit 37f9ff9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions layouts/partials/docs/item/media.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
{{- $noop := .Content -}}{{/* https://gohugo.io/troubleshooting/faq/#why-is-my-page-scratch-or-store-missing-a-value */}}
{{- $desktop := site.Params.docs.thumbnail.desktop | default false -}}
{{- $mobile := site.Params.docs.thumbnail.mobile | default false -}}
{{- if .Scratch.Get "large" -}}
{{- $desktop = site.Params.docs.thumbnail.desktop_large | default $desktop -}}
{{- end -}}
{{- if .Scratch.Get "scrollsnap" -}}
{{- $mobile = site.Params.docs.thumbnail.scrollsnap | default false -}}
{{- $mobile = site.Params.docs.thumbnail.scrollsnap | default $mobile -}}
{{- end -}}
{{- $lazy := .Scratch.Get "lazy" | default true -}}

<div class="media">
{{ with .Params.image }}
{{ partial "commons/image.html" (dict
"src" .src
"alt" .alt
"desktop" $desktop
"mobile" $mobile
"lazy" $lazy
"itemprop" "image"
) }}
{{ else }}
{{ with .Params.icon }}
<i class="icon icon-{{ . }}"></i>
{{ end }}
{{ end }}
</div>
</div>

{{- .Scratch.Delete "lazy" -}}
{{- .Scratch.Delete "scrollsnap" -}}
{{- .Scratch.Delete "large" -}}

0 comments on commit 37f9ff9

Please sign in to comment.