fix autocover partial
This commit is contained in:
parent
a634663b48
commit
e77948f3cd
@ -145,6 +145,11 @@ paginate = 5
|
|||||||
# it's set to `true` by default
|
# it's set to `true` by default
|
||||||
# oneHeadingSize = false
|
# oneHeadingSize = false
|
||||||
|
|
||||||
|
# if your resource directory contains an image called `cover.(jpg|png|webp)`,
|
||||||
|
# then the file will be used as a cover automatically.
|
||||||
|
# With this option you don't have to put the `cover` param in a front-matter.
|
||||||
|
# autoCover = true
|
||||||
|
|
||||||
[params.twitter]
|
[params.twitter]
|
||||||
# set Twitter handles for Twitter cards
|
# set Twitter handles for Twitter cards
|
||||||
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution
|
# see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{{- $cover := false -}}
|
{{- $cover := false -}}
|
||||||
{{- $autoCover := default $.Site.Params.autoCover false }}
|
{{- $autoCover := default $.Site.Params.autoCover false }}
|
||||||
|
|
||||||
{{- if index .Params "cover" -}}
|
{{- if index .Params "cover" -}}
|
||||||
{{- if .Resources.GetMatch .Params.Cover }}
|
{{- if .Resources.GetMatch .Params.Cover }}
|
||||||
{{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}}
|
{{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}}
|
||||||
@ -7,12 +8,13 @@
|
|||||||
{{- $cover = absURL .Params.Cover -}}
|
{{- $cover = absURL .Params.Cover -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else if $.Site.Params.AutoCover -}}
|
{{- else if $.Site.Params.AutoCover -}}
|
||||||
{{- if and ( index .Params "cover" ) (not .Params.Cover) -}}
|
{{- if (not .Params.Cover) -}}
|
||||||
{{- if .Resources.GetMatch "cover.*" -}}
|
{{- if .Resources.GetMatch "cover.*" -}}
|
||||||
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
|
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{if $cover -}}
|
{{if $cover -}}
|
||||||
<!-- Cover image found -->
|
<!-- Cover image found -->
|
||||||
<img src="{{ $cover }}"
|
<img src="{{ $cover }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user