🔀 Merge pull request #645 from stereobooster/provide-width-height

Provide width and height for images
pull/654/head
James Panther 2023-09-12 09:46:58 +10:00 committed by GitHub
commit 5a4c8b5450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,8 @@
{{ if eq .MediaType.SubType "svg" }} {{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}

View File

@ -20,6 +20,8 @@
{{ if eq .MediaType.SubType "svg" }} {{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}

View File

@ -22,6 +22,8 @@
{{- (.Fill "160x120 smart").RelPermalink }} {{- (.Fill "160x120 smart").RelPermalink }}
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x" 160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}" src="{{ (.Fill "160x120 smart").RelPermalink }}"
width="160"
height="120"
{{ end }} {{ end }}
{{ if $.Site.Params.enableImageLazyLoading | default true }} {{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy" loading="lazy"

View File

@ -27,6 +27,8 @@
{{ if eq .MediaType.SubType "svg" }} {{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }} {{ if lt .Width 660 }}
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
{{ else }} {{ else }}