refactor(partials): extract to native renderer

This commit is contained in:
kdevo
2021-10-09 16:04:49 +02:00
parent 621d0bc7c6
commit 8121a2f2e1
2 changed files with 15 additions and 9 deletions
+3 -6
View File
@@ -2,14 +2,11 @@
{{ $alt := .alt }}
{{ $noscriptSupport := .noscript }}
{{ $imgDict := .imgDict }}
{{ if $noscriptSupport }}
{{- if $noscriptSupport -}}
<noscript>
<!-- TODO: add responsiveness -->
<img src="{{ $imgDict.default.Permalink }}" {{ with $alt }} alt="{{ . }}" {{ end -}}
class="{{ $class }}" loading="lazy"
{{- with $imgDict.default }} height="{{ .Height }}" width="{{ .Width }}" {{ end -}}>
{{ partial "renderer/native" . }}
</noscript>
{{ end }}
{{- end -}}
<img
{{- with $imgDict.lqip -}}
{{- $placeholderB64 := .Content | base64Encode -}}
+9
View File
@@ -0,0 +1,9 @@
{{ $class := .class }}
{{ $alt := .alt }}
{{ $imgDict := .imgDict }}
<img src="{{ $imgDict.default.Permalink }}"
class="{{ $class }}" loading="lazy"
{{- with $imgDict.default }} height="{{ .Height }}" width="{{ .Width }}" {{- end -}}
{{- if $imgDict.responsive -}} {{ with partial "renderer/_srcset" $imgDict }} srcset="{{ . }}"{{- end }} {{- end -}}
{{- with $alt }} alt="{{ . }}" {{- end }}>