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

View File

@ -4,10 +4,17 @@
<h1>{{ .title | markdownify }}</h1> <h1>{{ .title | markdownify }}</h1>
</header> </header>
<div class="home-info-container"> <div class="home-info-container">
<a href="{{ .image.link | absURL }}" target="_blank" rel="noopener"> {{- 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" }}" <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 }}" /> title="{{ .image.title }}" height="{{ .image.height | default 150 }}" width="{{ .image.width | default 150 }}" />
</a> </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"> <div class="entry-content">
{{ .content | markdownify }} {{ .content | markdownify }}
</div> </div>