From 1991fdee587fa8a7dfff6b546312ce20e6e1cba0 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Wed, 10 Mar 2021 17:12:37 -0700 Subject: [PATCH] layouts/entry/single: fix a regression ... ... where if there is exactly one co-author, hugo will not treat this as an array, so that the if condition will fail. The fix simply fix this comparison by using the original value in the comparison --- layouts/entry/single.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layouts/entry/single.html b/layouts/entry/single.html index 55f7294..a3965ba 100644 --- a/layouts/entry/single.html +++ b/layouts/entry/single.html @@ -6,7 +6,8 @@
{{ .Title }}
- {{ if and $author (gt (len $coauthors) 1) }} + {{/* if $author && .Params.coauthor */}} + {{ if and $author .Params.coauthor }}

Written by {{ $author.name }} @@ -19,12 +20,12 @@ {{ $length := len $coauthors }} {{ range $i, $name := $coauthors }} {{ $coauthor := index $.Site.Data.authors $name }} - {{/* if i == length -1 */}} + {{/* if i == (length -1) */}} {{ if eq $i (sub $length 1) }} and {{ end }} {{ $coauthor.name }}{{- if lt $i (sub $length 1) -}},{{- end -}} - {{/* if i < length - 1 */}} + {{/* if i < (length - 1) */}} {{ end }} {{ end }} on {{ .Date.Format $.Site.Params.fmt.Date }}