Move cover to partial; need to verify that old behavior still works as intended.
This commit is contained in:
parent
61980c49d1
commit
67bb5735de
@ -39,16 +39,7 @@
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{- $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 }}
|
||||
{{ partial "cover.html" . }}
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
@ -29,17 +29,8 @@
|
||||
</span>
|
||||
{{ 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">
|
||||
{{ if .Params.showFullContent }}
|
||||
|
@ -20,17 +20,7 @@
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{- $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 }}
|
||||
{{ partial "cover.html" . }}
|
||||
|
||||
{{ if .Params.Toc }}
|
||||
<div class="table-of-contents">
|
||||
|
15
layouts/partials/cover.html
Normal file
15
layouts/partials/cover.html
Normal 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 }}
|
Loading…
Reference in New Issue
Block a user