aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-10 20:01:09 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-10 20:01:09 +0800
commitd0cf88cfc3d2c328f9e398ba94a770141f3a7be4 (patch)
tree8734557044fa622fdc71290453484429746fe3ed
parentrepo_{index,tree_dir}.html, style.css: Darker table title row (diff)
downloadforge-d0cf88cfc3d2c328f9e398ba94a770141f3a7be4.tar.gz
forge-d0cf88cfc3d2c328f9e398ba94a770141f3a7be4.tar.zst
forge-d0cf88cfc3d2c328f9e398ba94a770141f3a7be4.zip
category_index -> category_repos
Diffstat (limited to '')
-rw-r--r--handle_category_index.go4
-rw-r--r--main.go2
-rw-r--r--templates/category_repos.html (renamed from templates/category_index.html)6
-rw-r--r--templates/index.html2
4 files changed, 7 insertions, 7 deletions
diff --git a/handle_category_index.go b/handle_category_index.go
index d81899a..f9b201c 100644
--- a/handle_category_index.go
+++ b/handle_category_index.go
@@ -7,7 +7,7 @@ import (
"strings"
)
-func handle_category_index(w http.ResponseWriter, r *http.Request) {
+func handle_category_repos(w http.ResponseWriter, r *http.Request) {
data := make(map[string]any)
category_name := r.PathValue("category_name")
data["category_name"] = category_name
@@ -26,7 +26,7 @@ func handle_category_index(w http.ResponseWriter, r *http.Request) {
}
data["repos"] = repos
- err = templates.ExecuteTemplate(w, "category_index", data)
+ err = templates.ExecuteTemplate(w, "category_repos", data)
if err != nil {
_, _ = w.Write([]byte("Error rendering template: " + err.Error()))
return
diff --git a/main.go b/main.go
index 18733c4..81657cd 100644
--- a/main.go
+++ b/main.go
@@ -32,7 +32,7 @@ func main() {
}
http.HandleFunc("/{$}", handle_index)
- http.HandleFunc("/{category_name}/{$}", handle_category_index)
+ http.HandleFunc("/{category_name}/repos/{$}", handle_category_repos)
http.HandleFunc("/{category_name}/repos/{repo_name}/{$}", handle_repo_index)
http.HandleFunc("/{category_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree)
diff --git a/templates/category_index.html b/templates/category_repos.html
index 7f206a4..406fee4 100644
--- a/templates/category_index.html
+++ b/templates/category_repos.html
@@ -1,9 +1,9 @@
-{{- define "category_index" -}}
+{{- define "category_repos" -}}
<!DOCTYPE html>
<html>
<head>
{{ template "head_common" . }}
- <title>{{ .category_name }} &ndash; Lindenii Forge</title>
+ <title>Repos in {{ .category_name }} &ndash; Lindenii Forge</title>
</head>
<body class="category-index">
<div class="padding-wrapper">
@@ -13,7 +13,7 @@
<ul>
{{- range .repos }}
<li>
- <a href="repos/{{ . }}/">{{ . }}</a>
+ <a href="{{ . }}/">{{ . }}</a>
</li>
{{- end }}
</ul>
diff --git a/templates/index.html b/templates/index.html
index 7ced768..139abb0 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -13,7 +13,7 @@
<ul>
{{- range .categories }}
<li>
- <a href="{{ . }}/">{{ . }}</a>
+ <a href="{{ . }}/repos/">{{ . }}</a>
</li>
{{- end }}
</ul>