diff options
author | tdro <tdro@noreply.example.com> | 2022-12-02 00:14:29 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-02 00:14:29 -0500 |
commit | c1a0a33c40b08eb13e412a95cdcdfd869eb3bf2d (patch) | |
tree | cff78f0980fc0e2ec7201a92e5779aa894f1d5d2 /themes | |
parent | 5d0fb35704640dc02df9f14880b6ba29b68c8fc5 (diff) | |
download | canory-c1a0a33c40b08eb13e412a95cdcdfd869eb3bf2d.tar.gz canory-c1a0a33c40b08eb13e412a95cdcdfd869eb3bf2d.tar.bz2 canory-c1a0a33c40b08eb13e412a95cdcdfd869eb3bf2d.zip |
themes/default/layouts/partials/function-caches-images: Avoid public path split
Always ensure image target path
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/partials/function-caches-images.html | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/themes/default/layouts/partials/function-caches-images.html b/themes/default/layouts/partials/function-caches-images.html index 4e61760..2102bef 100644 --- a/themes/default/layouts/partials/function-caches-images.html +++ b/themes/default/layouts/partials/function-caches-images.html @@ -13,15 +13,9 @@ {{- $cached := and $isFile (fileExists (print "public/" $copy)) (fileExists (print "public/" $alternateCopy)) -}} {{- $local := print "public/" $source -}} {{- $localized := fileExists $local -}} -{{- $baseURL := "" -}} - -{{- if $baseURL -}} - {{- $baseURL = .Site.BaseURL -}} -{{- end -}} - -{{- $publicPath := print $baseURL "/public" -}} {{- with $404image := resources.Get "data/media/404.png" -}} + {{- $404image = .Content | resources.FromString (print $target (path.Base .)) -}} {{- $data = (dict "Width" $404image.Width @@ -34,19 +28,21 @@ {{- if $cached -}} {{- with $image := resources.Get (print "public/" $copy) -}} + {{- $image = .Content | resources.FromString (print $target (path.Base .)) -}} {{- $data = (dict - "Width" (strings.Replace $image.Width $publicPath $baseURL) - "Height" (strings.Replace $image.Height $publicPath $baseURL) - "Permalink" (strings.Replace $image.Permalink $publicPath $baseURL) - "RelPermalink" (strings.Replace $image.RelPermalink $publicPath $baseURL) + "Width" $image.Width + "Height" $image.Height + "Permalink" $image.Permalink + "RelPermalink" $image.RelPermalink ) -}} {{- $image = resources.Get (print "public/" $alternateCopy) -}} + {{- $image = .Content | resources.FromString (print $target (path.Base $image)) -}} {{- $data = merge $data (dict - "AltPermalink" (strings.Replace $image.Permalink $publicPath $baseURL) - "AltRelPermalink" (strings.Replace $image.RelPermalink $publicPath $baseURL) + "AltPermalink" $image.Permalink + "AltRelPermalink" $image.RelPermalink ) -}} {{- end -}} |