def _generate_site_navigation(pages_config, url_context, use_dir_urls=True):
 nav_items = []
 pages = []
 previous = None
 for config_line in pages_config:
  for page_or_header in _follow(config_line, url_context, use_dir_urls):
   if isinstance(page_or_header, Header):
    if page_or_header.is_top_level:
     nav_items.append(page_or_header)
   elif isinstance(page_or_header, Page):
    if page_or_header.is_top_level:
     nav_items.append(page_or_header)
    pages.append(page_or_header)
    if previous:
     page_or_header.previous_page = previous
     previous.next_page = page_or_header
    previous = page_or_header
 if (len(pages) == 0):
  raise exceptions.ConfigurationError(u'No pages found in the pages config. Remove it entirely to enable automatic page discovery.')
 return (nav_items, pages)

def _generate_site_navigation ( pages_config , url_context , use_dir_urls = True ) : nav_items = [ ] pages = [ ] previous = None for config_line in pages_config : for page_or_header in _follow ( config_line , url_context , use_dir_urls ) : if isinstance ( page_or_header , Header ) : if page_or_header . is_top_level : nav_items . append ( page_or_header ) elif isinstance ( page_or_header , Page ) : if page_or_header . is_top_level : nav_items . append ( page_or_header ) pages . append ( page_or_header ) if previous : page_or_header . previous_page = previous previous . next_page = page_or_header previous = page_or_header if ( len ( pages ) == 0 ) : raise exceptions . ConfigurationError ( u'No pages found in the pages config. Remove it entirely to enable automatic page discovery.' ) return ( nav_items , pages )
returns a list of page and header instances that represent the top level site navigation .