Add featured image to normal page template
This commit is contained in:
parent
1e17ccb801
commit
f601584822
2 changed files with 19 additions and 1 deletions
|
@ -3,5 +3,6 @@ title: "{{ replace .Name "-" " " | title }}"
|
||||||
date: {{ .Date }}
|
date: {{ .Date }}
|
||||||
draft: true
|
draft: true
|
||||||
comments: false
|
comments: false
|
||||||
|
images:
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,25 @@
|
||||||
|
{{ 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" }}
|
{{ define "header" }}
|
||||||
{{ partialCached "header.html" . }}
|
{{ partial "header.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
|
{{- if (or .Params.images .Params.featuredImg) }}
|
||||||
|
<div class="bg-img"></div>
|
||||||
|
{{- end }}
|
||||||
<main class="site-main section-inner thin animated fadeIn faster">
|
<main class="site-main section-inner thin animated fadeIn faster">
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
Loading…
Reference in a new issue