Skip to content

Commit

Permalink
🔀 Merge pull request #645 from stereobooster/provide-width-height
Browse files Browse the repository at this point in the history
Provide width and height for images
  • Loading branch information
jpanther authored Sep 11, 2023
2 parents ad8a1b0 + 22e1f17 commit 5a4c8b5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
{{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}"
{{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
Expand Down
2 changes: 2 additions & 0 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ <h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">
{{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}"
{{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/article-link.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
{{- (.Fill "160x120 smart").RelPermalink }}
160w, {{- (.Fill "320x240 smart").RelPermalink }} 2x"
src="{{ (.Fill "160x120 smart").RelPermalink }}"
width="160"
height="120"
{{ end }}
{{ if $.Site.Params.enableImageLazyLoading | default true }}
loading="lazy"
Expand Down
2 changes: 2 additions & 0 deletions layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
{{ if eq .MediaType.SubType "svg" }}
src="{{ .RelPermalink }}"
{{ else }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ if lt .Width 660 }}
src="{{ .RelPermalink }}"
{{ else }}
Expand Down

0 comments on commit 5a4c8b5

Please sign in to comment.