From 4289b8ac35a2a54d41f96337fe3926343e2ada9c Mon Sep 17 00:00:00 2001 From: leora Date: Thu, 15 Oct 2026 20:27:07 +0800 Subject: [PATCH] Follow-up: raise paging to 100, case-insensitive .profile, row sub-template, README notes Earlier commit 7a16ae0 'x' added the first README section for this change; it is kept rather than force-pushing the open PR branch. --- README.md | 18 ++- config/app.ini.template | 7 + .../custom/templates/explore/repo_list.tmpl | 134 +----------------- .../templates/explore/repo_list_item.tmpl | 66 +++++++++ 4 files changed, 90 insertions(+), 135 deletions(-) create mode 100644 config/custom/templates/explore/repo_list_item.tmpl diff --git a/README.md b/README.md index 0562cee..c47f14a 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,17 @@ https://gitea.seamtro.ai/leora/gitea-selfhost. Run the kit tests (above) first. ## Optional: list `.profile` repos last -`config/custom/templates/explore/repo_list.tmpl` overrides Gitea 1.23.x's repo list so that -`.profile` contact-card repos render after the other repos on each page (explore, user and org -pages). Copy it to `$GITEA_CUSTOM/templates/explore/` and restart Gitea. The reorder is per page, -so it is exact while all repos fit on one page (`[ui] EXPLORE_PAGING_NUM`, default 20). +`config/custom/templates/explore/repo_list.tmpl` (plus `repo_list_item.tmpl`, the shared row markup) +overrides Gitea 1.23.x's repo list so `.profile` contact-card repos (any case) render after the +other repos. The same list template is used by explore, user and org repo tabs, and the +starred / watched views, so they all get this order; admin repo management uses its own template +and is unchanged. + +To install, copy both files to `$GITEA_CUSTOM/templates/explore/` and restart Gitea. + +The reorder happens within each page. To keep whole lists in order, `config/app.ini.template` +sets `[ui] EXPLORE_PAGING_NUM = 100` and `[ui.user] REPO_PAGING_NUM = 100` (defaults are 20 and 15). +If an instance grows past 100 repos, raise these settings. + +On every Gitea upgrade, diff `templates/explore/repo_list.tmpl` in the new version against these +files and port any changes. Gitea refuses to start when a template has an error. diff --git a/config/app.ini.template b/config/app.ini.template index f74c9cf..e627f49 100644 --- a/config/app.ini.template +++ b/config/app.ini.template @@ -97,3 +97,10 @@ LEVEL = Info [other] SHOW_FOOTER_VERSION = false SHOW_FOOTER_TEMPLATE_LOAD_TIME = false + +; Large pages so the .profile-last template override orders whole lists, not just one page +[ui] +EXPLORE_PAGING_NUM = 100 + +[ui.user] +REPO_PAGING_NUM = 100 diff --git a/config/custom/templates/explore/repo_list.tmpl b/config/custom/templates/explore/repo_list.tmpl index 826b267..7207761 100644 --- a/config/custom/templates/explore/repo_list.tmpl +++ b/config/custom/templates/explore/repo_list.tmpl @@ -1,135 +1,7 @@
- {{/* seamtro: .profile contact-card repos listed last */}} - {{range .Repos}}{{if ne .Name ".profile"}} -
-
- {{template "repo/icon" .}} -
-
-
-
- {{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}} - {{.Owner.Name}}/ - {{end}} - {{.Name}} - - {{if .IsArchived}} - {{ctx.Locale.Tr "repo.desc.archived"}} - {{end}} - {{if .IsPrivate}} - {{ctx.Locale.Tr "repo.desc.private"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{ctx.Locale.Tr "repo.desc.internal"}} - {{end}} - {{end}} - {{if .IsTemplate}} - {{ctx.Locale.Tr "repo.desc.template"}} - {{end}} - {{if eq .ObjectFormatName "sha256"}} - {{ctx.Locale.Tr "repo.desc.sha256"}} - {{end}} - -
- -
- {{$description := .DescriptionHTML ctx}} - {{if $description}} -
{{$description}}
- {{end}} - {{if .Topics}} -
- {{range .Topics}} - {{if ne . ""}}{{.}}{{end}} - {{end}} -
- {{end}} -
{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}
-
-
- {{end}}{{end}} - {{range .Repos}}{{if eq .Name ".profile"}} -
-
- {{template "repo/icon" .}} -
-
-
-
- {{if and (or $.PageIsExplore $.PageIsProfileStarList) .Owner}} - {{.Owner.Name}}/ - {{end}} - {{.Name}} - - {{if .IsArchived}} - {{ctx.Locale.Tr "repo.desc.archived"}} - {{end}} - {{if .IsPrivate}} - {{ctx.Locale.Tr "repo.desc.private"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{ctx.Locale.Tr "repo.desc.internal"}} - {{end}} - {{end}} - {{if .IsTemplate}} - {{ctx.Locale.Tr "repo.desc.template"}} - {{end}} - {{if eq .ObjectFormatName "sha256"}} - {{ctx.Locale.Tr "repo.desc.sha256"}} - {{end}} - -
- -
- {{$description := .DescriptionHTML ctx}} - {{if $description}} -
{{$description}}
- {{end}} - {{if .Topics}} -
- {{range .Topics}} - {{if ne . ""}}{{.}}{{end}} - {{end}} -
- {{end}} -
{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}
-
-
- {{end}}{{end}} + {{/* seamtro: .profile contact-card repos (any case) listed last; row markup in explore/repo_list_item.tmpl */}} + {{range .Repos}}{{if ne .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}} + {{range .Repos}}{{if eq .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}} {{if not .Repos}}
{{ctx.Locale.Tr "search.no_results"}} diff --git a/config/custom/templates/explore/repo_list_item.tmpl b/config/custom/templates/explore/repo_list_item.tmpl new file mode 100644 index 0000000..f07adb7 --- /dev/null +++ b/config/custom/templates/explore/repo_list_item.tmpl @@ -0,0 +1,66 @@ +{{/* seamtro: one repo row, from Gitea 1.23.8 explore/repo_list.tmpl. Called with (dict "Repo" "Root" $) */}} +{{with .Repo}} +
+
+ {{template "repo/icon" .}} +
+
+
+
+ {{if and (or $.Root.PageIsExplore $.Root.PageIsProfileStarList) .Owner}} + {{.Owner.Name}}/ + {{end}} + {{.Name}} + + {{if .IsArchived}} + {{ctx.Locale.Tr "repo.desc.archived"}} + {{end}} + {{if .IsPrivate}} + {{ctx.Locale.Tr "repo.desc.private"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{ctx.Locale.Tr "repo.desc.internal"}} + {{end}} + {{end}} + {{if .IsTemplate}} + {{ctx.Locale.Tr "repo.desc.template"}} + {{end}} + {{if eq .ObjectFormatName "sha256"}} + {{ctx.Locale.Tr "repo.desc.sha256"}} + {{end}} + +
+ +
+ {{$description := .DescriptionHTML ctx}} + {{if $description}} +
{{$description}}
+ {{end}} + {{if .Topics}} +
+ {{range .Topics}} + {{if ne . ""}}{{.}}{{end}} + {{end}} +
+ {{end}} +
{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}
+
+
+{{end}}