Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/h-enk/doks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenk Verlinde <henk@ventizo.com>2022-03-25 15:57:52 +0300
committerGitHub <noreply@github.com>2022-03-25 15:57:52 +0300
commitb51feaca72229e6e8b4050ba8869857f9951eae0 (patch)
tree2d50cbfec1eede4a63b49a1b3ca6ffa6f7ca0f22
parentd127ee60b29915aff22f3ee4504f63db5c297847 (diff)
parent525ba3c1d2009af50ab65ce9ff963085fdf02dbc (diff)
Merge pull request #714 from james-d-elliott/fix-blog-byline
fix(layouts): use comma for more than 2 contributors
-rw-r--r--layouts/partials/main/blog-meta.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/layouts/partials/main/blog-meta.html b/layouts/partials/main/blog-meta.html
index a9eb438..d3cc3b7 100644
--- a/layouts/partials/main/blog-meta.html
+++ b/layouts/partials/main/blog-meta.html
@@ -1 +1,2 @@
-<p><small>Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }} and {{ end }}<a class="stretched-link position-relative" href="{{ "/contributors/" | relURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}}&nbsp;&hyphen;&nbsp;<strong>{{ .ReadingTime -}}&nbsp;min read</strong></small><p> \ No newline at end of file
+{{ $last := sub (len .Params.contributors) 1 }}
+<p><small>Posted {{ .PublishDate.Format "January 2, 2006" }} by {{ if .Params.contributors -}}{{ range $index, $contributor := .Params.contributors }}{{ if gt $index 0 }}{{ if eq $index $last }} and {{ else }}, {{ end }}{{ end }}<a class="stretched-link position-relative" href="{{ "/contributors/" | relURL }}{{ . | urlize }}/">{{ . }}</a>{{ end -}}{{ end -}}&nbsp;&hyphen;&nbsp;<strong>{{ .ReadingTime -}}&nbsp;min read</strong></small><p>