aboutsummaryrefslogtreecommitdiff
path: root/layouts/posts
diff options
context:
space:
mode:
authorTrack3 <pengliabc@live.cn>2019-01-01 17:53:20 +0800
committerTrack3 <pengliabc@live.cn>2019-01-01 17:53:20 +0800
commit1e17ccb8012d9ff48ceba737e49ec5e5444247d6 (patch)
tree1bf9d019c3902fc3e04d4005ae816c48c0b834e9 /layouts/posts
parentf38b9203b28aa8b2799d8de7a5c57a1a4aa4be0c (diff)
Remove inline style and script of bg-img
* See #22
Diffstat (limited to 'layouts/posts')
-rw-r--r--layouts/posts/single.html22
1 files changed, 16 insertions, 6 deletions
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 026a626..dc70fd3 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -1,14 +1,24 @@
+{{ define "head" }}
+ <style>
+ .bg-img {background-image: url('
+ {{- if .Params.featuredImg -}}
+ {{.Params.featuredImg | absURL}}
+ {{- else if .Params.images -}}
+ {{- range first 1 .Params.images -}}
+ {{. | absURL}}
+ {{- end -}}
+ {{- end -}}
+ ');}
+ </style>
+{{ end }}
+
{{ define "header" }}
{{ partial "header.html" . }}
{{ end }}
{{ define "main" }}
- {{- if .Params.featuredImg }}
- <div id="bg-img" class="bg-img" style="background-image: url({{.Params.featuredImg}});" onclick="showContent()"></div>
- {{- else if .Params.images }}
- {{- range first 1 .Params.images }}
- <div id="bg-img" class="bg-img" style="background-image: url({{.}});" onclick="showContent()"></div>
- {{- end }}
+ {{- if (or .Params.images .Params.featuredImg) }}
+ <div class="bg-img"></div>
{{- end }}
<main class="site-main section-inner animated fadeIn faster">
<article class="thin">