From 5e7d82b6cdf5e0ee5236b2d8fe17f3c700520da5 Mon Sep 17 00:00:00 2001
From: John Olheiser
Date: Fri, 10 Mar 2023 09:58:40 +0800
Subject: [PATCH] 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
Reviewed-on: https://gitea.com/gitea/theme/pulls/125
Reviewed-by: delvh
Reviewed-by: Lunny Xiao
Co-authored-by: John Olheiser
Co-committed-by: John Olheiser
---
layouts/post/list.html | 8 ++++----
layouts/post/single.html | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/layouts/post/list.html b/layouts/post/list.html
index b88bdd9..20751aa 100644
--- a/layouts/post/list.html
+++ b/layouts/post/list.html
@@ -15,13 +15,13 @@
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
-
- {{ $author | default $.Site.Params.author }}
+
+ {{ path.BaseName $author }}
{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
-
- {{ .Params.author | default .Site.Params.author }}
+
+ {{ path.BaseName (.Params.author | default .Site.Params.author) }}
{{ end }}
diff --git a/layouts/post/single.html b/layouts/post/single.html
index 851a5e5..886ef0d 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -18,13 +18,13 @@
{{ $s.Set "len" (len .Params.authors) }}
{{ $s.Add "len" -1 }}
{{ range $idx, $author := .Params.authors -}}
-
- {{ $author | default $.Site.Params.author }}
+
+ {{ path.BaseName $author }}
{{ if ne $idx ($s.Get "len") }}, {{end}}
{{- end }}
{{ else }}
-
- {{ .Params.author | default .Site.Params.author }}
+
+ {{ path.BaseName (.Params.author | default .Site.Params.author) }}
{{ end }}