feat: allow _Sidebar.md to override auto-generated wiki sidebar #664

Closed
opened 2026-06-21 06:16:53 +00:00 by jmiller · 1 comment
Owner

Summary

Currently the wiki sidebar navigation is auto-generated from the page list. Add support for an optional _Sidebar.md file that, when present, overrides the auto-generated sidebar with custom markdown content.

This is useful for fringe cases where the wiki author wants full control over sidebar navigation structure.

Current Behavior

  • Repo wiki (routers/web/repo/wiki.go): Already checks for _Sidebar content and renders it as WikiSidebarHTML, but the template may still show the auto-generated tree alongside it
  • Org wiki (routers/web/org/wiki.go): Already renders _Sidebar.md content into WikiSidebarHTML (lines 133-143), but the auto-generated page list is always shown

Desired Behavior

  • If _Sidebar.md exists in the wiki → render its content as the sidebar, hide the auto-generated page list/tree
  • If _Sidebar.md does not exist → show the auto-generated sidebar (current default behavior)
  • Both repo wikis and org wikis should support this override

Files to Modify

  • routers/web/repo/wiki.go — set a flag like WikiHasCustomSidebar when _Sidebar content is found
  • routers/web/org/wiki.go — same flag
  • templates/repo/wiki/view.tmpl — conditionally hide auto-generated tree when custom sidebar exists
  • templates/org/wiki/view.tmpl — same conditional
## Summary Currently the wiki sidebar navigation is auto-generated from the page list. Add support for an optional `_Sidebar.md` file that, when present, overrides the auto-generated sidebar with custom markdown content. This is useful for fringe cases where the wiki author wants full control over sidebar navigation structure. ## Current Behavior - **Repo wiki** (`routers/web/repo/wiki.go`): Already checks for `_Sidebar` content and renders it as `WikiSidebarHTML`, but the template may still show the auto-generated tree alongside it - **Org wiki** (`routers/web/org/wiki.go`): Already renders `_Sidebar.md` content into `WikiSidebarHTML` (lines 133-143), but the auto-generated page list is always shown ## Desired Behavior - If `_Sidebar.md` exists in the wiki → render its content as the sidebar, **hide** the auto-generated page list/tree - If `_Sidebar.md` does not exist → show the auto-generated sidebar (current default behavior) - Both repo wikis and org wikis should support this override ## Files to Modify - `routers/web/repo/wiki.go` — set a flag like `WikiHasCustomSidebar` when `_Sidebar` content is found - `routers/web/org/wiki.go` — same flag - `templates/repo/wiki/view.tmpl` — conditionally hide auto-generated tree when custom sidebar exists - `templates/org/wiki/view.tmpl` — same conditional
jmiller added the feature: wiki label 2026-06-21 13:41:48 +00:00
Author
Owner

Superseded by #680 (folder-based tree sidebar with _Sidebar.md override). The org wiki template now shows the auto-generated collapsible tree when no _Sidebar.md exists, and renders _Sidebar.md content when present.

Superseded by #680 (folder-based tree sidebar with _Sidebar.md override). The org wiki template now shows the auto-generated collapsible tree when no _Sidebar.md exists, and renders _Sidebar.md content when present.
Sign in to join this conversation.