Files
theme/layouts/post/single.html
John Olheiser 5e7d82b6cd Use custom URL if author starts with https:// (#125)
Resolves #124 and would allow for something like `author_domain: github.com` if the author instead has a profile there.

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/gitea/theme/pulls/125
Reviewed-by: delvh <dev.lh@web.de>
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>
2023-03-10 09:58:40 +08:00

41 lines
1.1 KiB
HTML

{{ partial "header.html" . }}
{{ partial "navbar.html" . }}
<section class="section">
<div class="container is-centered page">
<div class="content">
<h2>
<a href="{{ .Permalink }}">
{{ .Title }}
</a>
</h2>
<p>
<i>{{ .Date.Format "Mon Jan 2, 2006" }}</i>
{{ i18n "authored_by" }}
<b>
{{ if .Params.authors }}
{{ $s := newScratch }}
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
<a class="author" href="{{ if hasPrefix $author "https://" }}{{ $author }}{{ else }}https://gitea.com/{{ $author }}{{ end }}">
{{ path.BaseName $author }}
</a>{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
<a class="author" href="{{ if hasPrefix .Params.author "https://" }}{{ .Params.author }}{{ else }}https://gitea.com/{{ .Params.author }}{{ end }}">
{{ path.BaseName (.Params.author | default .Site.Params.author) }}
</a>
{{ end }}
</b>
</p>
{{ .Content }}
{{ partial "discourse.html" . }}
</div>
</div>
</section>
{{ partial "footer.html" . }}