4646 {'name' : 'section' , 'type' : 'string' },
4747 {'name' : 'subsection' , 'type' : 'string' , 'optional' : True },
4848 {'name' : 'is_component' , 'type' : 'bool' , 'optional' : True },
49- ]
50- }
51-
52- # Section display names to create breadcrumbs
53- SECTION_DISPLAY_NAMES = {
54- 'getting_started' : 'Getting Started' ,
55- 'library' : 'Components' ,
56- 'api-reference' : 'API Reference' ,
57- 'hosting' : 'Hosting' ,
58- 'events' : 'Events' ,
59- 'styling' : 'Styling' ,
60- 'state' : 'State' ,
61- 'vars' : 'Variables' ,
62- 'database' : 'Database' ,
63- 'authentication' : 'Authentication' ,
64- 'custom-components' : 'Custom Components' ,
65- 'wrapping-react' : 'Wrapping React' ,
66- 'ai_builder' : 'AI Builder' ,
67- 'recipes' : 'Recipes' ,
68- 'advanced_onboarding' : 'Advanced' ,
69- 'enterprise' : 'Enterprise' ,
70- 'utility_methods' : 'Utilities' ,
71- 'client_storage' : 'Client Storage' ,
72- 'components' : 'Components' ,
73- 'pages' : 'Pages' ,
74- 'assets' : 'Assets' ,
75- 'api-routes' : 'API Routes' ,
76- 'ui' : 'UI' ,
77- 'state_structure' : 'State Structure' ,
78- 'Blog' : 'Blog'
49+ #
50+ {'name' : 'weight' , 'type' : 'int32' }, # ← add this line
51+ ],
7952}
8053
8154class MarkdownProcessor :
@@ -255,17 +228,20 @@ def get_url_from_path(self, file_path: Path, docs_root: Path) -> str:
255228
256229 return url
257230
231+ def format_display_name (self , name : str ) -> str :
232+ # Basic title casing
233+ parts = name .replace ('-' , ' ' ).replace ('_' , ' ' ).split ()
234+ title = ' ' .join ([p .upper () if p .lower () in {"ai" , "ui" , "api" } else p .capitalize () for p in parts ])
235+ return title
236+
258237 def create_breadcrumb (self , document : dict ) -> str :
259238 """Create a breadcrumb string from document metadata."""
260239 parts = []
261240
262241 # Add section
263242 section = document .get ('section' , '' )
264243 if section :
265- section_display = SECTION_DISPLAY_NAMES .get (
266- section ,
267- section .replace ('-' , ' ' ).replace ('_' , ' ' ).title ()
268- )
244+ section_display = self .format_display_name (section )
269245 parts .append (section_display )
270246
271247 # Add subsection
@@ -294,6 +270,7 @@ def get_section_info(self, file_path: Path, docs_root: Path) -> tuple[str, Optio
294270 else :
295271 return parts [0 ], parts [1 ]
296272
273+
297274 def process_file (self , file_path : Path , content_root : Path , is_blog : bool = False ) -> Optional [Dict [str , Any ]]:
298275 """Process a single markdown file."""
299276 def normalize_slug (s : str ) -> str :
@@ -350,8 +327,6 @@ def normalize_slug(s: str) -> str:
350327 components = list (self .processor .extract_components (post .content ))
351328 code_examples = self .processor .extract_code_examples (post .content )
352329
353- print (url_path )
354-
355330 doc = {
356331 'id' : str (rel_path ),
357332 'title' : title ,
@@ -361,6 +336,7 @@ def normalize_slug(s: str) -> str:
361336 'url' : url_path ,
362337 'section' : section ,
363338 'is_component' : 'library' in rel_path .parts ,
339+ 'weight' : 2 if not is_blog else 1 ,
364340 }
365341
366342 doc ['breadcrumb' ] = self .create_breadcrumb (doc )
0 commit comments