aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--http_template_funcs.go4
-rw-r--r--resources.go1
-rw-r--r--templates/_group_path.tmpl2
-rw-r--r--templates/group.tmpl2
4 files changed, 7 insertions, 2 deletions
diff --git a/http_template_funcs.go b/http_template_funcs.go
index 8d67aff..b94e528 100644
--- a/http_template_funcs.go
+++ b/http_template_funcs.go
@@ -37,3 +37,7 @@ func dereferenceOrZero[T any](p *T) T {
var z T
return z
}
+
+func minus(a, b int) int {
+ return a - b
+}
diff --git a/resources.go b/resources.go
index 18f9849..df992ba 100644
--- a/resources.go
+++ b/resources.go
@@ -49,6 +49,7 @@ func loadTemplates() (err error) {
"path_escape": pathEscape,
"query_escape": queryEscape,
"dereference_error": dereferenceOrZero[error],
+ "minus": minus,
})
err = fs.WalkDir(resourcesFS, "templates", func(path string, d fs.DirEntry, err error) error {
diff --git a/templates/_group_path.tmpl b/templates/_group_path.tmpl
index 3a14edc..8904563 100644
--- a/templates/_group_path.tmpl
+++ b/templates/_group_path.tmpl
@@ -4,5 +4,5 @@
*/}}
{{- define "group_path_plain" -}}
{{- $p := . -}}
-{{- range $i, $s := . -}}{{- $s -}}{{- if ne $i (len $p) -}}/{{- end -}}{{- end -}}
+{{- range $i, $s := . -}}{{- $s -}}{{- if ne $i (minus (len $p) 1) -}}/{{- end -}}{{- end -}}
{{- end -}}
diff --git a/templates/group.tmpl b/templates/group.tmpl
index 98d4c76..3a4a7d1 100644
--- a/templates/group.tmpl
+++ b/templates/group.tmpl
@@ -13,7 +13,7 @@
<body class="group">
{{- template "header" . -}}
<div class="padding-wrapper">
- <p>{{- range $i, $s := .group_path -}}{{- $s -}}{{- if ne $i (len $group_path) }} / {{ end -}}{{- end -}}
+ <p>{{- range $i, $s := .group_path -}}{{- $s -}}{{- if ne $i (minus (len $group_path) 1) }} / {{ end -}}{{- end -}}
{{- if .description -}}
<p>{{- .description -}}</p>
{{- end -}}