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 | |
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')
13 files changed, 32 insertions, 20 deletions
diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html index 8f337ad..1a003fc 100644 --- a/themes/default/layouts/_default/_markup/render-image.html +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -17,7 +17,7 @@ {{- $cached := and (fileExists (print "public/" $fileCache ".webp")) (fileExists (print "public/" $fileCache (path.Ext $source))) -}} {{- if not $cached -}} - {{- with $remote := resources.GetRemote $source -}} + {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $source) -}} {{- with .Err -}} {{- if fileExists $public -}} {{- $local = resources.Get $public -}} diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html index 9c969c9..a1e43d2 100644 --- a/themes/default/layouts/partials/author-header.html +++ b/themes/default/layouts/partials/author-header.html @@ -8,6 +8,7 @@ {{- $image := partial "function-caches-images.html" (dict + "Context" . "Source" $header "Resize" "x600" "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") diff --git a/themes/default/layouts/partials/author-section-picture.html b/themes/default/layouts/partials/author-section-picture.html index 5b718d4..a3ff1f7 100644 --- a/themes/default/layouts/partials/author-section-picture.html +++ b/themes/default/layouts/partials/author-section-picture.html @@ -8,6 +8,7 @@ {{- $image := partial "function-caches-images.html" (dict + "Context" . "Source" $profile "Fit" "160x160" "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") diff --git a/themes/default/layouts/partials/function-caches-images.html b/themes/default/layouts/partials/function-caches-images.html index 2102bef..c99103b 100644 --- a/themes/default/layouts/partials/function-caches-images.html +++ b/themes/default/layouts/partials/function-caches-images.html @@ -1,3 +1,4 @@ +{{- $pageContext := .Context -}} {{- $data := dict -}} {{- $source := or .Source "nil" -}} {{- $fit := .Fit -}} @@ -47,7 +48,7 @@ -}} {{- end -}} {{- else -}} - {{- with $image := resources.GetRemote $source -}} + {{- with $image := cond (default true $pageContext.Site.Params.site.offline) false (resources.GetRemote $source) -}} {{- with .Err -}} {{- if $localized -}} {{- $directory := path.Dir $local -}} diff --git a/themes/default/layouts/partials/function-fetch-favicons.html b/themes/default/layouts/partials/function-fetch-favicons.html index 1d52c7e..7f92a94 100644 --- a/themes/default/layouts/partials/function-fetch-favicons.html +++ b/themes/default/layouts/partials/function-fetch-favicons.html @@ -1,12 +1,14 @@ -{{- $source := .Source -}} -{{- $infix := .Infix -}} +{{- $source := .Source -}} +{{- $infix := .Infix -}} +{{- $pageContext := .Context -}} {{- $output := partial "function-caches-images.html" (dict - "Source" $source - "Fit" "160x160" - "Target" (print (partial "function-paths.html" "media") "/") - "Copy" (print (partial "function-paths.html" "media") "/favicon." $infix ".png") + "Context" $pageContext + "Source" $source + "Fit" "160x160" + "Target" (print (partial "function-paths.html" "media") "/") + "Copy" (print (partial "function-paths.html" "media") "/favicon." $infix ".png") ) -}} diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 0bbaf46..42ffd8b 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -10,7 +10,7 @@ {{- $url := delimit (first 1 $data) "" -}} {{- $retitle := trim (delimit (after 1 $data) " ") " " -}} - {{- with $fetch := resources.GetRemote $url -}} + {{- with $fetch := cond (default true $.Site.Params.site.offline) false (resources.GetRemote $url) -}} {{- with $error := .Err -}} {{- warnf "Feed fetch %s" $error -}} @@ -197,6 +197,7 @@ {{- $imageSource := partial "function-fetch-favicons.html" (dict + "Context" $.Page "Source" $favicon "Infix" (.FeedSourceLink | anchorize) ) diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html index 7d934e6..af1a50d 100644 --- a/themes/default/layouts/partials/video-container.html +++ b/themes/default/layouts/partials/video-container.html @@ -22,7 +22,7 @@ {{- end -}} {{- if $notCached -}} - {{- with $remote := resources.GetRemote .Source -}} + {{- with $remote := cond (default true $.Context.Site.Params.site.offline) false (resources.GetRemote .Source) -}} {{- with .Err -}} {{- warnf "Video fetch %s" . -}} {{- if not (fileExists $public) -}} @@ -33,7 +33,7 @@ {{- $cache = $cache.Permalink -}} {{- end -}} {{- else -}} - {{- $caption = "No remote video data found for source" -}} + {{- $caption = "Unable to load remote source data" -}} {{- end -}} {{- else -}} {{- with $cache = resources.Get (path.Join "public/" $fileCache) -}} 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 -}} diff --git a/themes/default/layouts/shortcodes/link.html b/themes/default/layouts/shortcodes/link.html index efcdf78..49cd1c4 100644 --- a/themes/default/layouts/shortcodes/link.html +++ b/themes/default/layouts/shortcodes/link.html @@ -10,8 +10,9 @@ {{- $image := partial "function-fetch-favicons.html" (dict - "Source" $favicon - "Infix" ($host | anchorize) + "Context" .Page + "Source" $favicon + "Infix" ($host | anchorize) ) -}} diff --git a/themes/default/layouts/shortcodes/react.html b/themes/default/layouts/shortcodes/react.html index e7c260d..a36d113 100644 --- a/themes/default/layouts/shortcodes/react.html +++ b/themes/default/layouts/shortcodes/react.html @@ -7,6 +7,7 @@ {{- $image := partial "function-caches-images.html" (dict + "Context" .Page "Source" $source "Fit" "100x100" "Target" (print (partial "function-paths.html" "media") "/" $author "/") diff --git a/themes/default/layouts/shortcodes/react.rss.xml b/themes/default/layouts/shortcodes/react.rss.xml index 5ed5f80..429505d 100644 --- a/themes/default/layouts/shortcodes/react.rss.xml +++ b/themes/default/layouts/shortcodes/react.rss.xml @@ -7,6 +7,7 @@ {{- $image := partial "function-caches-images.html" (dict + "Context" .Page "Source" $source "Fit" "100x100" "Target" (print (partial "function-paths.html" "media") "/" $author "/") diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html index f712c51..11e7685 100644 --- a/themes/default/layouts/shortcodes/version.html +++ b/themes/default/layouts/shortcodes/version.html @@ -1,18 +1,20 @@ -{{- $version := "0.11.10" -}} +{{- $theme := "0.11.11" -}} +{{- $generator := "0.108.0" -}} + {{- $number := default false (.Get "number" | default (.Get 0)) -}} {{- $clone := default false (.Get "clone" | default (.Get 1)) -}} {{- $hugo := default false (.Get "hugo" | default (.Get 2)) -}} {{- if $number -}} - {{ $version }} + {{ $theme }} {{- end -}} {{- if $hugo -}} -0.108.0 + {{ $generator }} {{- end -}} {{- if $clone -}} ```shell -git clone --branch {{ $version }} https://www.thedroneely.com/git/thedroneely/canory +git clone --branch {{ $theme }} https://www.thedroneely.com/git/thedroneely/canory ``` {{- end -}} diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index 18065f8..289559c 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -19,6 +19,7 @@ (dict "Author" .Page.Section "Caption" $caption + "Context" .Page "End" $end "Height" $height "Options" $options |