diff --git a/apps/web/app/[section]/[...slug]/page.tsx b/apps/web/app/[section]/[...slug]/page.tsx index b3df3fa..e365199 100644 --- a/apps/web/app/[section]/[...slug]/page.tsx +++ b/apps/web/app/[section]/[...slug]/page.tsx @@ -325,7 +325,8 @@ export default async function DocPage({ params, searchParams }: DocPageProps) { // Any other key in the document metadata becomes a dynamic badge. const STANDARD_KEYS = new Set([ "id", "slug", "title", "type", "section", "status", - "author", "tags", "path", "createdAt", "updatedAt", "extraFields", + "author", "tags", "path", "createdAt", "updatedAt", + "extraFields", "body", ]); // Edit mode: inline form diff --git a/apps/web/app/components/Sidebar.tsx b/apps/web/app/components/Sidebar.tsx index cc77421..196cdcc 100644 --- a/apps/web/app/components/Sidebar.tsx +++ b/apps/web/app/components/Sidebar.tsx @@ -30,7 +30,7 @@ function buildFolderTree(docs: Doc[], section: string): TreeNode[] { for (const doc of docs.filter((d) => d.section === section)) { const parts = doc.slug.split("/"); - // parts[0] should be the section + // parts[0] is the section; skip it let current = root; for (let i = 1; i < parts.length; i++) { @@ -56,7 +56,7 @@ function buildFolderTree(docs: Doc[], section: string): TreeNode[] { } else if (!node.title) { node.title = part .split(/[-_]/) - .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) + .map((w) => (w ? w.charAt(0).toUpperCase() + w.slice(1) : "")) .join(" "); } current = node.children; @@ -91,6 +91,7 @@ function buildFolderTree(docs: Doc[], section: string): TreeNode[] { /** * Recursively render the folder tree with proper depth styling. + * Each level gets a 20px left margin + subtle border for visual hierarchy. */ function renderTreeNode( node: TreeNode, @@ -100,24 +101,24 @@ function renderTreeNode( const isFolder = node.children.length > 0; const isActive = pathname === `/${node.slug}`; const hasActiveChild = pathname.startsWith(`/${node.slug}/`); - const indent = depth * 16; // 16px per level return ( -
  • +
  • 0 ? "ml-5 border-l border-[#1f2022] pl-2" : ""}> - {isFolder ? "📁" : "📄"} - {node.title || node.name} + + {isFolder ? "📁" : "📄"} + {node.title || node.name} + {isFolder && node.docCount > 0 && ( {node.docCount} @@ -125,7 +126,7 @@ function renderTreeNode( )} {node.children.length > 0 && ( -