post-cover: use new format

usage =>
in page-vars front-matter

cover:
  image: '<image path/url>'
  alt: '<alt text>'
This commit is contained in:
Aditya Telange 2020-10-04 18:40:39 +05:30
parent 8cab9c9de5
commit 3068647f58
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
2 changed files with 12 additions and 12 deletions

View File

@ -31,13 +31,13 @@
{{- $class = "post-entry tag-entry" }}
{{- end }}
<article class="{{ $class }}">
{{- if .Params.cover }}
{{- if .Params.cover.image }}
<figure class="entry-cover">
{{ if (or (fileExists (path.Join "static" .Params.cover)) (hasPrefix .Params.cover "http://") (hasPrefix .Params.cover "https://")) }}
<img src="{{ .Params.cover | absURL }}" alt="cover image for {{ .Title | plainify }}">
{{else}}
<img src="{{ .Permalink -}} {{- .Params.cover }}" alt="cover image for {{ .Title | plainify }}">
{{end}}
{{- if (or (fileExists (path.Join "static" .Params.cover.image)) (hasPrefix .Params.cover.image "http://") (hasPrefix .Params.cover.image "https://")) }}
<img src="{{ .Params.cover.image | absURL }}" alt="{{ .Params.cover.alt | plainify }}">
{{- else}}
<img src="{{ .Permalink -}} {{- .Params.cover.image }}" alt="{{ .Params.cover.alt | plainify }}">
{{- end}}
</figure>
{{- end }}
<header class="entry-header">

View File

@ -26,13 +26,13 @@
</div>
{{- end}}
</header>
{{- if .Params.cover }}
{{- if .Params.cover.image }}
<figure class="entry-cover">
{{ if (or (fileExists (path.Join "static" .Params.cover)) (hasPrefix .Params.cover "http://") (hasPrefix .Params.cover "https://")) }}
<img src="{{ .Params.cover | absURL }}" alt="cover image for {{ .Title | plainify }}">
{{else}}
<img src="{{ .Permalink -}} {{- .Params.cover }}" alt="cover image for {{ .Title | plainify }}">
{{end}}
{{- if (or (fileExists (path.Join "static" .Params.cover.image)) (hasPrefix .Params.cover.image "http://") (hasPrefix .Params.cover.image "https://")) }}
<img src="{{ .Params.cover.image | absURL }}" alt="{{ .Params.cover.alt | plainify }}">
{{- else}}
<img src="{{ .Permalink -}} {{- .Params.cover.image }}" alt="{{ .Params.cover.alt | plainify }}">
{{- end}}
</figure>
{{- end }}
{{- if .Params.ShowToc }}