docs nav: promote Devices and Administration out of User Guide

Follows the developer/api → API Reference carve-out: placement-only, no
file paths or URLs change. placeDoc routes user/devices/* to a new
top-level "Devices" section (icon: device) and user/admin-* to a new
top-level "Administration" section (icon: shield); User Guide keeps its
direct guides with no groups. Sidebar order: Getting Started, User
Guide, Devices, Administration, API Reference, Developer, Operations,
Contributing.

Verified live: on kobo-setup the Devices section opens with the three
device guides; on admin-guide Administration opens with both admin
guides; on user/dashboard User Guide opens as before. Tests
(TestPlaceDoc, TestBuildNavigation) updated to pin the new placement.
This commit is contained in:
John O'Keefe committed 2026-10-25 21:10:53 -04:00
1 parent fb95b6d400
commit 27f42bf703
2 files changed
+28 -24

No files matched your search

+8 -4
View File
@@ -20,6 +20,8 @@ var sectionOrder = []struct {
}{
{Title: "Getting Started", Icon: "book-open"},
{Title: "User Guide", Icon: "book"},
{Title: "Devices", Icon: "device"},
{Title: "Administration", Icon: "shield"},
{Title: "API Reference", Icon: "list"},
{Title: "Developer", Icon: "gear"},
{Title: "Operations", Icon: "database"},
@@ -90,18 +92,20 @@ func placeDoc(docPath string) navPlacement {
case strings.HasPrefix(docPath, "user/"):
rest := strings.TrimPrefix(docPath, "user/")
if dir, _, ok := strings.Cut(rest, "/"); ok {
// Subdirectories become subcategories: device setup gets its
// own group, the admin-facing guides another.
// Device setup guides get their own top-level section (the
// directory stays where it is — placement is nav-only, same
// carve-out as developer/api → API Reference).
if dir == "devices" {
return navPlacement{section: "User Guide", group: "Devices", pin: pin}
return navPlacement{section: "Devices", pin: pin}
}
return navPlacement{section: "User Guide", group: titleCase(dir), pin: pin}
}
if rest == "user-guide.md" {
return navPlacement{section: "User Guide", pin: -50}
}
// Admin-facing guides are their own top-level section too.
if strings.HasPrefix(rest, "admin-") {
return navPlacement{section: "User Guide", group: "Administration"}
return navPlacement{section: "Administration"}
}
return navPlacement{section: "User Guide"}