Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <jimmehcai@gmail.com>2020-09-12 23:14:32 +0300
committerJimmy Cai <jimmehcai@gmail.com>2020-09-12 23:14:32 +0300
commitf0b3617ec4eae79af296421b117ccef33f33450e (patch)
tree92bb1e83b355aa9a11a3bce246dfe0055599d658
parent426d1f3846bbba776f116913d9b81ab3deecaaac (diff)
fix(helper/image): add support for relative linked image
-rw-r--r--layouts/partials/helper/image.html10
1 files changed, 2 insertions, 8 deletions
diff --git a/layouts/partials/helper/image.html b/layouts/partials/helper/image.html
index 5276f2e..8534592 100644
--- a/layouts/partials/helper/image.html
+++ b/layouts/partials/helper/image.html
@@ -12,20 +12,14 @@
{{ $result = merge $result (dict "permalink" $imageValue) }}
{{ else }}
{{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
- {{ $siteResourceImage := resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
{{ if $pageResourceImage }}
<!-- If image is found under page bundle -->
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
- {{ else if $siteResourceImage }}
- <!-- Try search image under site's assets folder -->
- {{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }}
- {{ $result = merge $result (dict "resource" $siteResourceImage) }}
{{ else }}
- <!-- Can not find the image -->
- {{ errorf "Failed loading image: %q" $imageValue }}
- {{ $result = merge $result (dict "exists" false) }}
+ <!-- Can not find the image under page bundle. Could be a relative linked image -->
+ {{ $result = merge $result (dict "permalink" $imageValue) }}
{{ end }}
{{ end }}