diff options
author | Henk Verlinde <henk@ventizo.com> | 2022-03-25 15:57:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 15:57:52 +0300 |
commit | b51feaca72229e6e8b4050ba8869857f9951eae0 (patch) | |
tree | 2d50cbfec1eede4a63b49a1b3ca6ffa6f7ca0f22 | |
parent | d127ee60b29915aff22f3ee4504f63db5c297847 (diff) | |
parent | 525ba3c1d2009af50ab65ce9ff963085fdf02dbc (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.html | 3 |
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 -}} ‐ <strong>{{ .ReadingTime -}} 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 -}} ‐ <strong>{{ .ReadingTime -}} min read</strong></small><p> |