Allow single page and list layouts to make use of a full URL for the cover

This commit is contained in:
Eelco Wesemann 2019-02-05 16:27:59 +01:00
parent 58fbfec07b
commit 7e813c3565
2 changed files with 12 additions and 2 deletions

View File

@ -23,7 +23,12 @@
{{ end }} {{ end }}
{{ with .Params.Cover }} {{ with .Params.Cover }}
<img src="{{ printf "img/%s" . | absURL }}" class="post-cover" /> {{ $imgurl := urls.Parse . }}
{{ if $imgurl.Scheme }}
<img src="{{ printf "%s" . | safeURL }}" class="post-cover" />
{{ else }}
<img src="{{ printf "img/%s" . | absURL }}" class="post-cover" />
{{ end }}
{{ end }} {{ end }}
<div class="post-content"> <div class="post-content">

View File

@ -17,7 +17,12 @@
{{ end }} {{ end }}
{{ with .Params.Cover }} {{ with .Params.Cover }}
<img src="{{ printf "img/%s" . | absURL }}" class="post-cover" /> {{ $imgurl := urls.Parse . }}
{{ if $imgurl.Scheme }}
<img src="{{ printf "%s" . | safeURL }}" class="post-cover" />
{{ else }}
<img src="{{ printf "img/%s" . | absURL }}" class="post-cover" />
{{ end }}
{{ end }} {{ end }}
<div class="post-content"> <div class="post-content">