Move cover to partial; need to verify that old behavior still works as intended.

This commit is contained in:
Morgan Gangwere 2021-05-04 19:33:35 -07:00
parent 61980c49d1
commit 67bb5735de
4 changed files with 19 additions and 32 deletions

View File

@ -39,17 +39,8 @@
{{ end }} {{ end }}
{{- $cover := false -}} {{ partial "cover.html" . }}
{{- $autoCover := default $.Site.Params.autoCover false }}
{{- if $autoCover -}}
{{- $cover = .Resources.GetMatch "cover.*" -}}
{{- else if .Params.Cover -}}
{{- if .Resources.GetMatch .Params.Cover }}
{{ $cover = .Resources.GetMatch .Params.Cover }}
{{- end -}}
{{- end -}}
{{if $cover -}} <img src="{{ $cover.Permalink }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />{{- end }}
<div class="post-content"> <div class="post-content">
{{ if .Params.showFullContent }} {{ if .Params.showFullContent }}

View File

@ -29,17 +29,8 @@
</span> </span>
{{ end }} {{ end }}
{{ partial "cover.html" . }}
{{- $cover := false -}}
{{- $autoCover := default $.Site.Params.autoCover false }}
{{- if $autoCover -}}
{{- $cover = .Resources.GetMatch "cover.*" -}}
{{- else if .Params.Cover -}}
{{- if .Resources.GetMatch .Params.Cover }}
{{ $cover = .Resources.GetMatch .Params.Cover }}
{{- end -}}
{{- end -}}
{{if $cover -}} <img src="{{ $cover.Permalink }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />{{- end }}
<div class="post-content"> <div class="post-content">
{{ if .Params.showFullContent }} {{ if .Params.showFullContent }}

View File

@ -20,17 +20,7 @@
{{ end }} {{ end }}
</span> </span>
{{ end }} {{ end }}
{{ partial "cover.html" . }}
{{- $cover := false -}}
{{- $autoCover := default $.Site.Params.autoCover false }}
{{- if $autoCover -}}
{{- $cover = .Resources.GetMatch "cover.*" -}}
{{- else if .Params.Cover -}}
{{- if .Resources.GetMatch .Params.Cover }}
{{ $cover = .Resources.GetMatch .Params.Cover }}
{{- end -}}
{{- end -}}
{{if $cover -}} <img src="{{ $cover.Permalink }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />{{- end }}
{{ if .Params.Toc }} {{ if .Params.Toc }}
<div class="table-of-contents"> <div class="table-of-contents">

View File

@ -0,0 +1,15 @@
{{- $cover := false -}}
{{- $autoCover := default $.Site.Params.autoCover false }}
{{- if $autoCover -}}
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
{{- else if .Params.Cover -}}
{{- if .Resources.GetMatch .Params.Cover }}
{{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}}
{{- else -}}
{{- $cover = absURL .Params.Cover -}}
{{- end -}}
{{- end -}}
{{if $cover -}}
<!-- Cover image found -->
<img src="{{ $cover }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
{{- end }}