Merge pull request #250 from indrora/page-bundles
Use Page Bundles, automatically use cover file if available. Closes #249, #274
This commit is contained in:
commit
a634663b48
@ -38,9 +38,9 @@
|
|||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Params.Cover }}
|
|
||||||
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
|
{{ partial "cover.html" . }}
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
{{ if .Params.showFullContent }}
|
{{ if .Params.showFullContent }}
|
||||||
|
@ -29,9 +29,8 @@
|
|||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Params.Cover }}
|
{{ partial "cover.html" . }}
|
||||||
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
{{ if .Params.showFullContent }}
|
{{ if .Params.showFullContent }}
|
||||||
|
@ -26,10 +26,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ partial "cover.html" . }}
|
||||||
{{ if .Params.Cover }}
|
|
||||||
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if .Params.Toc }}
|
{{ if .Params.Toc }}
|
||||||
<div class="table-of-contents">
|
<div class="table-of-contents">
|
||||||
|
22
layouts/partials/cover.html
Normal file
22
layouts/partials/cover.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{{- $cover := false -}}
|
||||||
|
{{- $autoCover := default $.Site.Params.autoCover false }}
|
||||||
|
{{- if index .Params "cover" -}}
|
||||||
|
{{- if .Resources.GetMatch .Params.Cover }}
|
||||||
|
{{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $cover = absURL .Params.Cover -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- else if $.Site.Params.AutoCover -}}
|
||||||
|
{{- if and ( index .Params "cover" ) (not .Params.Cover) -}}
|
||||||
|
{{- if .Resources.GetMatch "cover.*" -}}
|
||||||
|
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{if $cover -}}
|
||||||
|
<!-- Cover image found -->
|
||||||
|
<img src="{{ $cover }}"
|
||||||
|
class="post-cover"
|
||||||
|
alt="{{ .Title | plainify | default " " }}"
|
||||||
|
title="{{ .Params.CoverCredit |plainify|default "Cover Image" }}" />
|
||||||
|
{{- end }}
|
Loading…
Reference in New Issue
Block a user