Skip to content

Commit

Permalink
fix: process static image url correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
imfing committed Sep 24, 2023
1 parent b283227 commit 79883dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{- if and $dest $isRemote -}}
{{- if $startsWithSlash -}}
{{/* Images under static directory */}}
{{- $dest = (relURL $dest) -}}
{{- $dest = (relURL (strings.TrimPrefix "/" $dest)) -}}
{{- else if and $isPage (not $startsWithRelative) -}}
{{/* Images that are sibling to the individual page file */}}
{{ $dest = (printf "../%s" $dest) }}
Expand Down
4 changes: 3 additions & 1 deletion layouts/shortcodes/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
{{- $image = $processed.RelPermalink -}}
{{- else -}}
{{/* Otherwise, use relative link of the image */}}
{{- $image = ($image | relURL) -}}
{{- if hasPrefix $image "/" -}}
{{- $image = relURL (strings.TrimPrefix "/" $image) -}}
{{- end -}}
{{- end -}}
{{- end -}}

Expand Down

0 comments on commit 79883dc

Please sign in to comment.