From b8b1cba41c944610f4d51d6368902425d5c32143 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 2 Nov 2023 11:11:08 -0400 Subject: themes/default/layouts: Namespacing --- themes/default/layouts/_default/_markup/render-image.html | 10 +++++----- themes/default/layouts/shortcodes/attach.html | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'themes/default/layouts') diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html index 6f702e3..116d280 100644 --- a/themes/default/layouts/_default/_markup/render-image.html +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -13,8 +13,8 @@ {{- $author := .Page.Section -}} {{- $relURL := strings.TrimPrefix .Page.Site.BaseURL .Page.Permalink -}} {{- $immutable := print ($relURL | humanize | urlize) "-" ($source | sha256 | truncate 8 "") -}} -{{- $fileCache := print (partial "function-paths.html").media "/" $author "/" $immutable -}} -{{- $cached := and (fileExists (print "public/" $fileCache ".webp")) (fileExists (print "public/" $fileCache (path.Ext $source))) -}} +{{- $storage := print (partial "function-paths.html").media "/" $author "/" $immutable -}} +{{- $cached := and (fileExists (print "public/" $storage ".webp")) (fileExists (print "public/" $storage (path.Ext $source))) -}} {{- if not $cached -}} {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $source) -}} @@ -38,7 +38,7 @@ {{- end -}} {{- end -}} {{- else -}} - {{- $exists = resources.Get (print "public/" $fileCache (path.Ext $source)) -}} + {{- $exists = resources.Get (print "public/" $storage (path.Ext $source)) -}} {{- $exists = $exists.Content | resources.FromString (print (partial "function-paths.html").media "/" $author "/" (path.Base $exists)) -}} {{- end -}} @@ -67,8 +67,8 @@ {{- end -}} {{- with $exists }} - {{- if fileExists (print "public/" $fileCache ".webp") -}} - {{- $srcset = print ("" | absURL) "/" $fileCache ".webp" -}} + {{- if fileExists (print "public/" $storage ".webp") -}} + {{- $srcset = print ("" | absURL) "/" $storage ".webp" -}} {{- end -}} {{- if fileExists (print "public/" $author "/media/" $immutable ".webp") -}} {{- $srcset = print ("" | absURL) "/" $author "/media/" $immutable ".webp" -}} diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html index dfd472f..238e0cd 100644 --- a/themes/default/layouts/shortcodes/attach.html +++ b/themes/default/layouts/shortcodes/attach.html @@ -10,8 +10,8 @@ {{- $immutable := print $url | anchorize -}} {{- $localFile := path.Join "public/" $url -}} {{- $type := "application/octet-stream" -}} -{{- $fileCache := print $author "/media/" $immutable $extension -}} -{{- $cached := fileExists (path.Join "public/" $fileCache) -}} +{{- $storage := print $author "/media/" $immutable $extension -}} +{{- $cached := fileExists (path.Join "public/" $storage) -}} {{- if not $cached -}} {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $url) -}} @@ -22,7 +22,7 @@ {{- end -}} {{- else -}} {{- $type = $remote.MediaType -}} - {{- $cache = $remote | resources.Copy $fileCache -}} + {{- $cache = $remote | resources.Copy $storage -}} {{- $cache = $cache.Permalink -}} {{- end -}} {{- else -}} @@ -30,7 +30,7 @@ {{- warnf "Attachment remote fetch error: %s" $url -}} {{- end -}} {{- else -}} - {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}} + {{- with $cache = resources.Get (path.Join "public/" $storage) -}} {{- $type = .MediaType -}} {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}} {{- end -}} -- cgit v1.2.3