refactor(docs): replace deprecated strings.Title with cases.Title

strings.Title has been deprecated since Go 1.18 because it does not
handle Unicode properly. Replace it with cases.Title from
golang.org/x/text which correctly handles language-specific title
casing. Applied to breadcrumb generation and document title formatting.
This commit is contained in:
2026-04-20 20:42:58 -04:00
parent 4e326dfc86
commit 77cbbf600b
2 changed files with 9 additions and 4 deletions
+4 -1
View File
@@ -5,6 +5,9 @@ import (
"strings"
"bookhoard/templates"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
// BuildNavigation creates the navigation structure from the docs filesystem
@@ -100,7 +103,7 @@ func (h *DocsHandler) getDocTitle(docPath string) string {
filename := parts[len(parts)-1]
// Convert to title case
title = strings.Title(strings.ReplaceAll(filename, "-", " "))
title = cases.Title(language.English).String(strings.ReplaceAll(filename, "-", " "))
// Handle special cases
switch filename {