diff options
author | tdro <tdro@noreply.example.com> | 2023-11-02 11:11:08 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-11-02 11:11:08 -0400 |
commit | b8b1cba41c944610f4d51d6368902425d5c32143 (patch) | |
tree | abcbe8897be8d3d9a0a2a50459900c70ad32b200 /themes/default/layouts | |
parent | 8a77cf95f080b06bf95f51e365d955844f08c075 (diff) | |
download | canory-b8b1cba41c944610f4d51d6368902425d5c32143.tar.gz canory-b8b1cba41c944610f4d51d6368902425d5c32143.tar.bz2 canory-b8b1cba41c944610f4d51d6368902425d5c32143.zip |
themes/default/layouts: Namespacing
Diffstat (limited to 'themes/default/layouts')
-rw-r--r-- | themes/default/layouts/_default/_markup/render-image.html | 10 | ||||
-rw-r--r-- | themes/default/layouts/shortcodes/attach.html | 8 |
2 files changed, 9 insertions, 9 deletions
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 -}} |