add base image location
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
{{/* Input: Input: dict {"responsive": [RESOURCE, ...]}. Output: srcset string */}}
|
||||
|
||||
{{/* Input: dict {"responsive": [RESOURCE, ...], "imageBasePath": "/images/lazyimg"} */}}
|
||||
{{ $images := .responsive }}
|
||||
{{ $base := default "/images/lazyimg" .imageBasePath }}
|
||||
{{ $srcset := slice }}
|
||||
{{ range $images }}
|
||||
{{ $srcset = append (printf "%s %dw" .Permalink .Width) $srcset }}
|
||||
{{ $u := path.Join $base (strings.TrimPrefix "/" .RelPermalink) }}
|
||||
{{ $srcset = append (printf "%s %dw" $u .Width) $srcset }}
|
||||
{{ end }}
|
||||
{{ return (delimit $srcset ",\n") }}
|
||||
{{ return (delimit $srcset ",\n") }}
|
||||
|
||||
Reference in New Issue
Block a user