mirror of https://github.com/artifacthub/blog.git
Make the link template handle abs and other domain urls
Signed-off-by: Matt Farina <matt.farina@suse.com>
This commit is contained in:
parent
1ab43d9c2f
commit
24a09c86e7
Binary file not shown.
|
|
@ -1 +1,11 @@
|
|||
<img src="{{ printf "%s%s" .Page.Permalink .Destination | safeURL }}" {{ with .Text }} alt="{{ . }}" {{ end }} {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
{{ $dest := .Destination -}}
|
||||
{{ $url := urls.Parse .Destination -}}
|
||||
{{ if eq $url.Host "" -}}
|
||||
{{ if hasPrefix $url.Path "/" -}}
|
||||
{{ $base := strings.TrimSuffix "/" .Page.Site.BaseURL -}}
|
||||
{{ $dest = printf "%s%s" $base .Destination -}}
|
||||
{{ else -}}
|
||||
{{ $dest = printf "%s%s" .Page.Permalink .Destination -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
<img src="{{ $dest | safeURL }}" {{ with .Text }} alt="{{ . }}" {{ end }} {{ with .Title }} title="{{ . }}" {{ end }} />
|
||||
Loading…
Reference in New Issue