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 }}
|
||||
draft: true
|
||||
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" }}
|
||||
{{ partialCached "header.html" . }}
|
||||
{{ partial "header.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "main" }}
|
||||
{{- if (or .Params.images .Params.featuredImg) }}
|
||||
<div class="bg-img"></div>
|
||||
{{- end }}
|
||||
<main class="site-main section-inner thin animated fadeIn faster">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div class="content">
|
||||
|
|
Loading…
Reference in a new issue