From b0856bf1548a26c1c2924cc011f4a1ddc2707b5f Mon Sep 17 00:00:00 2001 From: tdro Date: Fri, 3 Mar 2023 17:34:06 -0500 Subject: config: Support offline mode Default to offline. The configuration has to set the site's offline configuration to false for remote fetches to be allowed --- themes/default/layouts/shortcodes/attach.html | 6 +++--- themes/default/layouts/shortcodes/link.html | 5 +++-- themes/default/layouts/shortcodes/react.html | 1 + themes/default/layouts/shortcodes/react.rss.xml | 1 + themes/default/layouts/shortcodes/version.html | 10 ++++++---- themes/default/layouts/shortcodes/video.html | 1 + 6 files changed, 15 insertions(+), 9 deletions(-) (limited to 'themes/default/layouts/shortcodes') 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 -- cgit v1.2.3