feat(article-link): add support for hotlinkFeatureImages

This commit is contained in:
ZhenShuo Leo committed 2025-09-26 22:06:53 +08:00
1 parent 7cb8dcc4a1
commit 4b9e63fd99
12 files changed
+199 -76

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
{{/* disableImageOptimization */}}
{{ site.Store.Set "disableImageOptimization" (site.Params.disableImageOptimization | default false) }}
{{/* defaultFeaturedImage */}}
{{ $defaultFeaturedImage := "" }}
{{ $defaultFeaturedImageURL := "" }}
{{ with site.Params.defaultFeaturedImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ if site.Params.hotlinkFeatureImages }}
{{ $defaultFeaturedImageURL = . }}
{{ else }}
{{ $defaultFeaturedImage = resources.GetRemote . }}
{{ end }}
{{ else }}
{{ $defaultFeaturedImage = resources.Get . }}
{{ end }}
{{ end }}
{{ site.Store.Set "defaultFeaturedImage" (dict "url" $defaultFeaturedImageURL "obj" $defaultFeaturedImage) }}
{{/* defaultBackgroundImage */}}
{{ $defaultBackgroundImage := "" }}
{{ $defaultBackgroundImageURL := "" }}
{{ with site.Params.defaultBackgroundImage }}
{{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }}
{{ if site.Params.hotlinkFeatureImages }}
{{ $defaultBackgroundImageURL = . }}
{{ else }}
{{ $defaultBackgroundImage = resources.GetRemote . }}
{{ end }}
{{ else }}
{{ $defaultBackgroundImage = resources.Get . }}
{{ end }}
{{ end }}
{{ site.Store.Set "defaultBackgroundImage" (dict "url" $defaultBackgroundImageURL "obj" $defaultBackgroundImage) }}