Fix display of persons
This commit is contained in:
parent
e0946e6c59
commit
a025961ad5
@ -2,5 +2,6 @@
|
||||
title: "Joseph Ripp"
|
||||
draft: true
|
||||
image: ""
|
||||
sex: male
|
||||
headless: true
|
||||
---
|
||||
|
@ -2,5 +2,6 @@
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
draft: true
|
||||
image: ""
|
||||
sex: male
|
||||
headless: true
|
||||
---
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="image">
|
||||
{{- $param := . -}}
|
||||
{{- with .image -}}
|
||||
<img src="{{ .RelPermalink }}" {{ with $param.name }}alt="Bild {{ . }}"{{ end }}>
|
||||
<img src="{{ . }}" {{ with $param.name }}alt="Bild {{ $param.name }}"{{ end }}>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
|
@ -1,16 +1,23 @@
|
||||
{{ with .Site.GetPage "person" }}
|
||||
{{/*{{ $person := . }}*/}}
|
||||
{{ with .GetPage ($.Get "name") }}
|
||||
{{ $imageName := .Params.Get "image" }}
|
||||
{{ $image := "" }}
|
||||
{{ with .Resources.GetMatch $imageName}}
|
||||
{{ $image = . }}
|
||||
{{ $image = .RelPermalink }}
|
||||
{{ else }}
|
||||
{{ warnf "Image for %s is not correclty found. Falling back to default." ($.Get "name") }}
|
||||
{{ with .Resources.ByType "image" }}
|
||||
{{ $image = index . 0 }}
|
||||
{{ $image = (index . 0).RelPermalink }}
|
||||
{{ else }}
|
||||
{{/* $image */}}
|
||||
{{ with .Params.Get "sex" }}
|
||||
{{ if eq . "male" }}
|
||||
{{ $image = relURL "img/persons/male.png" }}
|
||||
{{ else }}
|
||||
{{ errorf "Generic female icon not found." }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ warnf "Cannot find sex of %s." ($.Get "name") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $config :=
|
||||
|
Loading…
Reference in New Issue
Block a user