Use custom URL if author starts with https:// #125

Merged
lunny merged 4 commits from jolheiser/theme:custom-url into main 2023-03-10 01:58:40 +00:00
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://gitea.com/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
<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="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
<a class="author" href="{{ if hasPrefix .Params.author "https://" }}{{ .Params.author }}{{ else }}https://gitea.com/{{ .Params.author }}{{ end }}">
jolheiser marked this conversation as resolved Outdated
Outdated
Review

Please also adapt it in #18.

Please also adapt it in `#18`.
{{ 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://gitea.com/{{ $author | default $.Site.Params.author }}">
{{ $author | default $.Site.Params.author }}
<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="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
{{ .Params.author | default .Site.Params.author }}
<a class="author" href="{{ if hasPrefix .Params.author "https://" }}{{ .Params.author }}{{ else }}https://gitea.com/{{ .Params.author }}{{ end }}">
jolheiser marked this conversation as resolved Outdated
Outdated
Review

Please adapt it in #21 as well.

Please adapt it in `#21` as well.
{{ path.BaseName (.Params.author | default .Site.Params.author) }}
</a>
{{ end }}
</b>