Skip to content

Commit

Permalink
fix: correct the default thumbnail in the case of baseURL contains su…
Browse files Browse the repository at this point in the history
…bpaths (#484)
  • Loading branch information
razonyang authored Nov 14, 2023
1 parent ca765d1 commit 52e6a74
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions layouts/partials/hb/modules/blog/post/card-img.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
{{- $img = index . 0 }}
{{- else }}
{{- $res := partialCached "hb/functions/page-thumbnail" . . }}
{{- $default := site.Params.hb.blog.post_thumbnail_default }}
{{/* Get the default thumbnail if set. */}}
{{- if and (not $res) $default }}
{{- $res = resources.Get $default }}
{{- end }}
{{- with $res }}
{{- $img = replace .RelPermalink $page.RelPermalink "" | printf "%s?height=360px" }}
{{- if $res }}
{{- $img = replace $res.Permalink $page.Permalink "" | printf "%s?height=360" }}
{{- else }}
{{/* Get the default thumbnail if set. */}}
{{- $default := site.Params.hb.blog.post_thumbnail_default }}
{{- with resources.Get $default }}
{{- $img = strings.TrimPrefix "/" $default | printf "/%s?height=360" }}
{{- end }}
{{- end }}
{{- end -}}
{{- with $img }}
Expand Down

0 comments on commit 52e6a74

Please sign in to comment.