Include height/width for cover images
This commit is contained in:
parent
26ad260858
commit
ca6ebdce7e
@ -79,8 +79,17 @@
|
|||||||
&-cover {
|
&-cover {
|
||||||
border: 20px solid var(--accent);
|
border: 20px solid var(--accent);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
margin: 40px 0;
|
margin: 10px 0 0;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
display: inline-block;
|
||||||
|
object-fit: cover;
|
||||||
|
|
||||||
|
img {
|
||||||
|
min-width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
@media (--phone) {
|
@media (--phone) {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -1,24 +1,32 @@
|
|||||||
{{- $cover := false -}}
|
{{- $cover := false -}}
|
||||||
{{- $autoCover := default $.Site.Params.autoCover false }}
|
{{- $coverImg := 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 -}}
|
{{- $coverImg = (.Resources.GetMatch .Params.Cover) -}}
|
||||||
|
{{- $cover = $coverImg.RelPermalink -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $cover = relURL .Params.Cover -}}
|
{{- $cover = relURL .Params.Cover -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- else if $.Site.Params.AutoCover -}}
|
{{- else if $.Site.Params.AutoCover -}}
|
||||||
{{- if (not .Params.Cover) -}}
|
{{- if (not .Params.Cover) -}}
|
||||||
{{- if .Resources.GetMatch "cover.*" -}}
|
{{- if .Resources.GetMatch "cover.*" -}}
|
||||||
{{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}}
|
{{- $coverImg = .Resources.GetMatch "cover.*" -}}
|
||||||
|
{{- $cover = $coverImg.RelPermalink -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{if $cover -}}
|
{{if $cover -}}
|
||||||
<!-- Cover image found -->
|
<div class="post-cover">
|
||||||
<img src="{{ $cover }}"
|
<img src="{{ $cover }}"
|
||||||
class="post-cover"
|
|
||||||
alt="{{ .Title | plainify | default " " }}"
|
alt="{{ .Title | plainify | default " " }}"
|
||||||
title="{{ .Params.CoverCredit |plainify|default "Cover Image" }}" />
|
title="{{ .Params.CoverCredit |plainify|default "Cover Image" }}"
|
||||||
{{- end }}
|
{{- if $coverImg -}}
|
||||||
|
width="{{ $coverImg.Width }}"
|
||||||
|
height="{{ $coverImg.Height }}"
|
||||||
|
{{- end -}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{{- end -}}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user