feat: works if no img specified or no img.link specified

This commit is contained in:
leovct 2023-05-10 03:09:36 +02:00 committed by Léo Vincent
parent f7b26bef73
commit c2bc65e9c9
2 changed files with 11 additions and 6 deletions

View File

@ -6,7 +6,6 @@
.home-info-container img {
flex: 1;
flex-shrink: 0;
width: 100%;
height: auto;
max-width: 600px;
margin-right: 20px;
@ -14,7 +13,6 @@
}
.home-info-container ul {
padding-left: 20px;
list-style-type: none;
}

View File

@ -4,10 +4,17 @@
<h1>{{ .title | markdownify }}</h1>
</header>
<div class="home-info-container">
<a href="{{ .image.link | absURL }}" target="_blank" rel="noopener">
<img draggable="false" src="{{ .image.url | absURL }}" alt=" {{ .image.title | default "profile image" }}"
title="{{ .image.title }}" height="{{ .image.height | default 150 }}" width="{{ .image.width | default 150 }}" />
</a>
{{- if .image.url}}
{{- if .image.link -}}
<a href="{{ .image.link | absURL }}" target="_blank" rel="noopener" style="width: 100%">
<img draggable="false" src="{{ .image.url | absURL }}" alt=" {{ .image.title | default "profile image" }}"
title="{{ .image.title }}" height="{{ .image.height | default 150 }}" width="{{ .image.width | default 150 }}" />
</a>
{{- else }}
<img draggable="false" src="{{ .image.url | absURL }}" alt=" {{ .image.title | default "profile image" }}"
title="{{ .image.title }}" height="{{ .image.height | default 150 }}" width="{{ .image.width | default 150 }}" />
{{- end }}
{{- end}}
<div class="entry-content">
{{ .content | markdownify }}
</div>