summaryrefslogtreecommitdiff
path: root/themes/terminal/layouts/partials/cover.html
blob: ea562ead45bcb4d94ace758c788b4097f3818a4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{{- $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 (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 }}