diff options
author | tdro <tdro@noreply.example.com> | 2023-03-03 17:34:06 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-03-03 18:48:17 -0500 |
commit | b0856bf1548a26c1c2924cc011f4a1ddc2707b5f (patch) | |
tree | 6449acc1cde1b7b2dbf463468e4e18e87fd1e83c /themes/default/layouts/shortcodes/attach.html | |
parent | 20355368f64f8d2889832db28e352f80bce18783 (diff) | |
download | canory-b0856bf1548a26c1c2924cc011f4a1ddc2707b5f.tar.gz canory-b0856bf1548a26c1c2924cc011f4a1ddc2707b5f.tar.bz2 canory-b0856bf1548a26c1c2924cc011f4a1ddc2707b5f.zip |
config: Support offline mode0.11.11
Default to offline. The configuration has to set the site's offline
configuration to false for remote fetches to be allowed
Diffstat (limited to 'themes/default/layouts/shortcodes/attach.html')
-rw-r--r-- | themes/default/layouts/shortcodes/attach.html | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html index c122d75..f453da5 100644 --- a/themes/default/layouts/shortcodes/attach.html +++ b/themes/default/layouts/shortcodes/attach.html @@ -13,7 +13,7 @@ {{- $notCached := not (fileExists (path.Join "public/" $fileCache)) -}} {{- if $notCached -}} - {{- with $remote := resources.GetRemote $url -}} + {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $url) -}} {{- with .Err -}} {{- warnf "Attachment fetch %s" . -}} {{- if not (fileExists $fileCache) -}} @@ -25,7 +25,7 @@ {{- $cache = $cache.Permalink -}} {{- end -}} {{- else -}} - {{- $caption = "No remote attachment data found for source" -}} + {{- $caption = "Unable to load remote source data" -}} {{- end -}} {{- else -}} {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}} @@ -35,7 +35,7 @@ {{- end -}} {{- end -}} -{{- $data := $cache -}} +{{- $data := or $cache $url -}} {{- if $remote -}} {{- $data = $url -}} |