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-12-25 11:39:04 +0300
committerGitHub <noreply@github.com>2020-12-25 11:39:04 +0300
commita5820c6f520cd007e60938146fe9197decaf8c29 (patch)
tree7cdb98924bdc4d7f6b8d5e9e6051bfce9ced7c07
parent80be1b2435a115173ff6f53944ae41f2ec210f1d (diff)
fix(search): wrong permalink to page (#93)
- Show external image closes https://github.com/CaiJimmy/hugo-theme-stack/issues/92
-rw-r--r--layouts/page/search.json14
1 files changed, 8 insertions, 6 deletions
diff --git a/layouts/page/search.json b/layouts/page/search.json
index 34d05c2..5d4e627 100644
--- a/layouts/page/search.json
+++ b/layouts/page/search.json
@@ -8,15 +8,17 @@
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
- {{- if and $image.exists $image.resource -}}
- {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
+ {{- if $image.exists -}}
+ {{- $imagePermalink := "" -}}
+ {{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
- {{- $image := dict "image" (absURL $thumbnail.Permalink) -}}
+ {{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
{{- else -}}
- {{- $image := dict "image" (absURL $image.resource.Permalink) -}}
+ {{- $imagePermalink = $image.permalink -}}
{{- end -}}
- {{- $data = merge $data $image -}}
- {{ end }}
+
+ {{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
+ {{- end -}}
{{- $result = $result | append $data -}}
{{- end -}}