-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add default image size for lazy loaded images
- Loading branch information
1 parent
da8dd5f
commit bcd81e6
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
<img loading="lazy" src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} /> | ||
{{ $image := .Page.Resources.GetMatch .Destination }} | ||
{{ if not $image }} | ||
{{ $image = resources.Get .Destination }} | ||
{{ end }} | ||
{{ with $image }} | ||
{{ warnf "%q" .Permalink }} | ||
<img | ||
src="{{ .Permalink }}" | ||
alt="{{ .Title }}" | ||
loading="lazy" | ||
width="{{ .Width }}" | ||
height="{{ .Height }}" | ||
{{ with .Title}}title="{{ . }}"{{ end }} | ||
/> | ||
{{ end }} |