@@ -1425,8 +1425,12 @@ def _update_sidebar_from_sections(self) -> None:
14251425 # Handle both string and dict formats
14261426 if isinstance (item , str ):
14271427 section_entry ["contents" ].append (f"reference/{ item } .qmd" )
1428+ elif isinstance (item , dict ):
1429+ # Extract the name from dict format (e.g., {'name': 'Graph', 'members': []})
1430+ item_name = item .get ("name" , str (item ))
1431+ section_entry ["contents" ].append (f"reference/{ item_name } .qmd" )
14281432 else :
1429- # If it's a dict with name/contents, handle appropriately
1433+ # Fallback for unexpected types
14301434 section_entry ["contents" ].append (f"reference/{ item } .qmd" )
14311435
14321436 sidebar_contents .append (section_entry )
@@ -1447,7 +1451,7 @@ def _update_sidebar_from_sections(self) -> None:
14471451 yaml .dump (config , f , default_flow_style = False , sort_keys = False )
14481452
14491453 def _update_reference_index_frontmatter (self ) -> None :
1450- """Add frontmatter to reference/index.qmd to hide the sidebar ."""
1454+ """Ensure reference/index.qmd has proper frontmatter ."""
14511455 index_path = self .docs_dir / "reference" / "index.qmd"
14521456
14531457 if not index_path .exists ():
@@ -1457,21 +1461,12 @@ def _update_reference_index_frontmatter(self) -> None:
14571461 with open (index_path , "r" ) as f :
14581462 content = f .read ()
14591463
1460- # Check if frontmatter already exists
1464+ # Check if frontmatter already exists - if so, leave it as is
14611465 if content .startswith ("---" ):
1462- # Parse existing frontmatter
1463- parts = content .split ("---" , 2 )
1464- if len (parts ) >= 3 :
1465- frontmatter = parts [1 ]
1466- body = parts [2 ]
1467-
1468- # Add sidebar: false if not present
1469- if "sidebar:" not in frontmatter :
1470- frontmatter = frontmatter .rstrip () + "\n sidebar: false\n "
1471- content = f"---{ frontmatter } ---{ body } "
1472- else :
1473- # Add new frontmatter
1474- content = f"---\n sidebar: false\n ---\n \n { content } "
1466+ return
1467+
1468+ # Add minimal frontmatter if none exists
1469+ content = f"---\n ---\n \n { content } "
14751470
14761471 # Write updated content
14771472 with open (index_path , "w" ) as f :
0 commit comments