feat: infer from URL

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
jolheiser 2023-03-09 16:56:02 -06:00
parent 57c764754b
commit 7c33619e3f
No known key found for this signature in database
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 8 additions and 8 deletions

View File

@ -15,13 +15,13 @@
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
<a class="author" href="https://{{ $.Params.author_domain | default "gitea.com" }}/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
<a class="author" href="{{ if hasPrefix $author "http" }}{{ $author }}{{ else }}https://gitea.com/{{ $author }}{{ end }}">
{{ path.BaseName $author }}
</a>{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
<a class="author" href="https://{{ .Params.author_domain | default "gitea.com" }}/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
<a class="author" href="{{ if hasPrefix .Params.author "http" }}{{ .Params.author }}{{ else }}https://gitea.com/{{ .Params.author }}{{ end }}">
{{ path.BaseName (.Params.author | default .Site.Params.author) }}
</a>
{{ end }}
</p>

View File

@ -18,13 +18,13 @@
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
<a class="author" href="https://{{ $.Params.author_domain | default "gitea.com" }}/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
<a class="author" href="{{ if hasPrefix $author "http" }}{{ $author }}{{ else }}https://gitea.com/{{ $author }}{{ end }}">
{{ path.BaseName $author }}
</a>{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
<a class="author" href="https://{{ .Params.author_domain | default "gitea.com" }}/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
<a class="author" href="{{ if hasPrefix .Params.author "http" }}{{ .Params.author }}{{ else }}https://gitea.com/{{ .Params.author }}{{ end }}">
{{ path.BaseName (.Params.author | default .Site.Params.author) }}
</a>
{{ end }}
</b>