-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Bug
After the pssg consolidation in 8f1470b (Feb 17), sites generated by arch-docs show:
- 0 for all taxonomy hero stats (Node Types, Languages, Domains, Subdomains, etc.) even though taxonomy entries render correctly via
{{range}} - Empty architecture overview graph on the homepage (
#arch-overview-datais"")
Working example (built before consolidation): https://repos.supermodeltools.com/supermodel-api-docs/
Broken example (built after): https://repos.supermodeltools.com/typescript-sdk/
Root Cause
1. Custom len function missing []taxonomy.Entry type
internal/pssg/render/funcs.go introduces a custom length template function with a type switch:
func length(v interface{}) int {
switch val := v.(type) {
case []string:
return len(val)
case []*entity.Entity:
return len(val)
// ... other types
}
return 0 // ← falls through for []taxonomy.Entry
}When templates call {{len .Entries}} on taxonomy data ([]taxonomy.Entry), no case matches and it returns 0. Meanwhile {{range .Entries}} works fine because Go's range uses native reflection.
Fix: Replace the brittle type switch with reflect.ValueOf(v).Len() to handle any slice/map/string generically.
2. ArchData never populated in renderHomepage
Commit 080b1f2 added the ArchData field to HomepageContext and the template references it, but renderHomepage in build.go never sets it. It always renders as "".
Fix: Build domain graph JSON (nodes + links) from the taxonomy data in renderHomepage.
Affected Templates
index.html— homepage hero stats (all 0), arch overview graph (empty)taxonomy_index.html— "0 categories available"letter.html— "0 entries starting with X"