Allow multiple authors (#120)

![preview](https://gitea.com/attachments/2eabf87e-712f-41f5-9e52-28b0fb0bb61e)

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/theme/pulls/120
Reviewed-by: pat-s <pat-s@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Co-committed-by: John Olheiser <john+gitea@jolheiser.com>
This commit is contained in:
John Olheiser 2023-01-27 13:56:55 +08:00 committed by Lunny Xiao
parent 9237f02532
commit 64f4349699
3 changed files with 32 additions and 6 deletions

View File

@ -10,9 +10,20 @@
<div class="media-content">
<a class="title is-4" href="{{ .Permalink }}">{{ .Title }}</a>
<p class="subtitle is-6">{{ .Date.Format "Mon Jan 2, 2006" }} {{ i18n "authored_by" }}
<a href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
</a>
{{ if .Params.authors }}
{{ $s := newScratch }}
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
<a class="author" href="https://gitea.com/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
</a>{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
<a class="author" href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
</a>
{{ end }}
</p>
</div>
</div>

View File

@ -13,9 +13,20 @@
<i>{{ .Date.Format "Mon Jan 2, 2006" }}</i>
{{ i18n "authored_by" }}
<b>
<a href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
</a>
{{ if .Params.authors }}
{{ $s := newScratch }}
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
<a class="author" href="https://gitea.com/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
</a>{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
<a class="author" href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
</a>
{{ end }}
</b>
</p>

View File

@ -45,6 +45,10 @@ $tertiary: #4183c4;
}
}
a.author {
display: inline-block !important;
}
.page .card{
margin-bottom: 2em;