Support external header images

Close #461 and #488
This commit is contained in:
Alex Hogen authored and gcushen committed 2018-03-13 00:13:48 +00:00
1 parent 917d4b5126
commit fdfc961f34
4 files changed
+25 -4

No files matched your search

+7 -1
View File
@@ -1,6 +1,12 @@
{{ if .Params.header.image }}
<div class="article-header">
<img src="{{ "/img/" | relURL }}{{ .Params.header.image }}" class="article-banner" itemprop="image">
{{ $img_src := urls.Parse .Params.header.image }}
{{ if $img_src.Scheme }}
<img src="{{ .Params.header.image }}" class="article-banner" itemprop="image">
{{ else }}
<img src="{{ "/img/" | relURL }}{{ .Params.header.image }}" class="article-banner" itemprop="image">
{{ end }}
{{ with .Params.header.caption }}<span class="article-header-caption">{{ . | markdownify | emojify }}</span>{{ end }}
</div>
{{end}}
+6 -1
View File
@@ -6,7 +6,12 @@
{{ $preview := $post.Params.header.preview | default true }}
{{ if and $post.Params.header.image $preview }}
<a href="{{ $post.Permalink }}">
<img src="{{ "/img/" | relURL }}{{ $post.Params.header.image }}" class="article-banner" itemprop="image">
{{ $img_src := urls.Parse $post.Params.header.image }}
{{ if $img_src.Scheme }}
<img src="{{ $post.Params.header.image }}" class="article-banner" itemprop="image">
{{ else }}
<img src="{{ "/img/" | relURL }}{{ $post.Params.header.image }}" class="article-banner" itemprop="image">
{{ end }}
</a>
{{end}}
<h3 class="article-title" itemprop="headline">
@@ -8,7 +8,12 @@
{{ if .Scratch.Get "image" }}
<div>
<a href="{{ .Permalink }}">
<img src="{{ "/img/" | relURL }}{{ .Scratch.Get "image" }}" class="pub-banner" itemprop="image">
{{ $img_src := urls.Parse .Scratch.Get "image" }}
{{ if $img_src.Scheme }}
<img src="{{ .Scratch.Get "image" }}" class="article-banner" itemprop="image">
{{ else }}
<img src="{{ "/img/" | relURL }}{{ .Scratch.Get "image" }}" class="article-banner" itemprop="image">
{{ end }}
</a>
</div>
{{ end }}
+6 -1
View File
@@ -8,7 +8,12 @@
{{ if .Scratch.Get "image" }}
<div>
<a href="{{ .Permalink }}">
<img src="{{ "/img/" | relURL }}{{ .Scratch.Get "image" }}" class="pub-banner" itemprop="image">
{{ $img_src := urls.Parse .Scratch.Get "image" }}
{{ if $img_src.Scheme }}
<img src="{{ .Scratch.Get "image" }}" class="article-banner" itemprop="image">
{{ else }}
<img src="{{ "/img/" | relURL }}{{ .Scratch.Get "image" }}" class="article-banner" itemprop="image">
{{ end }}
</a>
</div>
{{ end }}