mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2025-01-12 14:33:19 -05:00
add comments and refactor more
This commit is contained in:
parent
86b5018dfe
commit
cb1059e04d
@ -10,6 +10,8 @@
|
||||
{{- $pageBundleCover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||
{{- $globalResourcesCover := (resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }}
|
||||
{{- $cover := (or $pageBundleCover $globalResourcesCover)}}
|
||||
{{/* We are not using the .Param.cover.relative to decide the location of image */}}
|
||||
{{/* If we have the image in pageBundle or globalResources we can process the image */}}
|
||||
|
||||
{{- $sizes := (slice "360" "480" "720" "1080" "1500") }}
|
||||
{{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}}
|
||||
@ -26,7 +28,8 @@
|
||||
<a href="{{ $imgdl }}" target="_blank" rel="noopener noreferrer">
|
||||
{{- end }}
|
||||
|
||||
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
|
||||
{{- if $cover -}}
|
||||
{{/* i.e it is present in page bundle */}}
|
||||
{{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }}
|
||||
<img loading="{{$loading}}"
|
||||
srcset='{{- range $size := $sizes -}}
|
||||
@ -42,7 +45,8 @@
|
||||
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
|
||||
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
|
||||
{{- end }}
|
||||
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
|
||||
{{- else }}
|
||||
{{/* For absolute urls and external links, no img processing here */}}
|
||||
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
|
||||
{{- end }}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user