Skip to content

Commit

Permalink
fix(search): correct the links of thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Mar 21, 2022
1 parent 5517148 commit 738fd2e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions layouts/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
{{- end -}}
{{- $img := "" -}}
{{- if .Params.Images -}}
{{- $imgFile := index .Params.Images 0 -}}
{{- $resource := .Resources.GetMatch (strings.TrimPrefix "/" $imgFile) -}}
{{- if $resource -}}
{{- $img = $resource.Permalink -}}
{{- else -}}
{{- $img = $imgFile | absURL -}}
{{- $img = index .Params.Images 0 | absURL -}}
{{- else -}}
{{- $images := .Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
{{- $img = $featured.Permalink -}}
{{- end -}}
{{- end -}}
{{- $item := (dict "title" $title "tags" .Params.tags "categories" .Params.categories "series" .Params.series "content" .Plain "permalink" .Permalink "date" $date "img" $img) -}}
Expand Down

0 comments on commit 738fd2e

Please sign in to comment.