mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2025-01-12 22:43:20 -05:00
Refactor 4
This commit is contained in:
parent
677dc06194
commit
7295940a76
@ -17,8 +17,13 @@
|
|||||||
{{- $processableFormats = $processableFormats | append "webp" -}}
|
{{- $processableFormats = $processableFormats | append "webp" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- $imgdl := (.Params.cover.image) | absURL }}
|
||||||
|
{{- if $cover -}}
|
||||||
|
{{- $imgdl = $cover.Permalink }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- if $addLink }}
|
{{- if $addLink }}
|
||||||
<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" rel="noopener noreferrer">
|
<a href="{{ $imgdl }}" target="_blank" rel="noopener noreferrer">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
|
{{- if $cover -}}{{/* i.e it is present in page bundle */}}
|
||||||
@ -28,15 +33,13 @@
|
|||||||
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}}
|
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"
|
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}"
|
||||||
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}"
|
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}"
|
||||||
width="{{ $cover.Width }}" height="{{ $cover.Height }}">
|
width="{{ $cover.Width }}" height="{{ $cover.Height }}" alt="{{ $alt }}">
|
||||||
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
|
{{- else }}{{/* Unprocessable image or responsive images disabled */}}
|
||||||
<img loading="{{$loading}}" src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
|
{{- else }}{{/* For absolute urls and external links, no img processing here */}}
|
||||||
{{- if $addLink }}<a href="{{ (.Params.cover.image) | absURL }}" target="_blank"
|
<img loading="{{ $loading }}" src="{{ $imgdl }}" alt="{{ $alt }}">
|
||||||
rel="noopener noreferrer">{{ end -}}
|
|
||||||
<img loading="{{$loading}}" src="{{ (.Params.cover.image) | absURL }}" alt="{{ $alt }}">
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $addLink }}
|
{{- if $addLink }}
|
||||||
|
Loading…
Reference in New Issue
Block a user