mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-02 14:46:25 +00:00
Convert all images to webp when possible
This commit is contained in:
@@ -3,10 +3,14 @@
|
||||
<a href="{{ .Get "link" }}" {{ with .Get "target" }} target="{{ . }}" {{ end }}{{ with .Get "rel" }} rel="{{ . }}"
|
||||
{{ end }}>
|
||||
{{- end -}}
|
||||
<img src="{{ .Get "src" }}" {{- if or (.Get "alt") (.Get "caption") }}
|
||||
{{- if eq (.Get "raw") true }}
|
||||
{{- $img := resources.Get (.Get "src") }}
|
||||
<img src="{{ $img.Permalink }}" {{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" {{- end -}}
|
||||
{{- with .Get "width" }} width="{{ . }}" {{ end -}} {{- with .Get "height" }} height="{{ . }}" {{ end -}} />
|
||||
<!-- Closing img tag -->
|
||||
width="{{ .Get "width" | default $img.Width }}" height="{{ .Get "height" | default $img.Height }}" />
|
||||
{{- else }}
|
||||
{{- partial "image.html" (dict "path" (.Get "src") "alt" (or (.Get "alt") (.Get "caption" | markdownify | plainify) | default " ") "width" (.Get "width") "height" (.Get "height")) }}
|
||||
{{- end }}
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
||||
<figcaption>
|
||||
|
||||
Reference in New Issue
Block a user