plain site; demo content added; re-terminal theme enabled; some theme customizations
This commit is contained in:
54
themes/re-terminal/layouts/partials/cover.html
Normal file
54
themes/re-terminal/layouts/partials/cover.html
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
|
||||
{{- $ctx := "" -}}
|
||||
{{- $isCoverCaptionEnabled := default nil -}}
|
||||
{{- if (reflect.IsMap . ) -}}
|
||||
{{- /* Assign Custom Context */ -}}
|
||||
{{- $ctx = .ctx -}}
|
||||
{{- /* Assign value of .isCoverCaptionEnabled */ -}}
|
||||
{{- $isCoverCaptionEnabled = cond (not .isCoverCaptionEnabled) nil .isCoverCaptionEnabled -}}
|
||||
{{- else -}}
|
||||
{{- /* Passing dot context, default behaviour */ -}}
|
||||
{{- $ctx = . -}}
|
||||
{{- /* Default isCoverCaptionEnabled for Dot Context */ -}}
|
||||
{{- $isCoverCaptionEnabled = false -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- $cover := false -}}
|
||||
{{- $autoCover := default $.Site.Params.autoCover false }}
|
||||
|
||||
{{- if index $ctx.Params "cover" -}}
|
||||
{{- if .Resources.GetMatch $ctx.Params.Cover }}
|
||||
{{- $cover = (.Resources.GetMatch $ctx.Params.Cover).RelPermalink -}}
|
||||
{{- else -}}
|
||||
{{- $cover = absURL $ctx.Params.Cover -}}
|
||||
{{- end -}}
|
||||
{{- else if $.Site.Params.AutoCover -}}
|
||||
{{- if (not $ctx.Params.Cover) -}}
|
||||
{{- if .Resources.GetMatch "cover.*" -}}
|
||||
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $cover -}}
|
||||
{{ if and $ctx.Params.coverCaption $isCoverCaptionEnabled }}
|
||||
<figure>
|
||||
<!-- Cover image found -->
|
||||
<img src="{{ $cover }}"
|
||||
class="post-cover"
|
||||
alt="{{ .Title | plainify | default " " }}"
|
||||
title="{{ $ctx.Params.CoverCredit |plainify|default "Cover Image" }}" />
|
||||
|
||||
<figcaption class="right">{{ $ctx.Params.coverCaption | safeHTML }}</figcaption>
|
||||
</figure>
|
||||
{{ else }}
|
||||
<!-- Cover image found -->
|
||||
<img src="{{ $cover }}"
|
||||
class="post-cover"
|
||||
alt="{{ .Title | plainify | default " " }}"
|
||||
title="{{ $ctx.Params.CoverCredit |plainify|default "Cover Image" }}" />
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
Reference in New Issue
Block a user