From e3aa27cc31242c594fcf337c269b3ffa60ca7472 Mon Sep 17 00:00:00 2001 From: Yen Ton Date: Sun, 3 Mar 2024 01:01:03 -0800 Subject: [PATCH] sorted sub-subsection by subsection --- lib/docs/filters/nextjs/clean_html.rb | 1 + lib/docs/filters/nextjs/entries.rb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/docs/filters/nextjs/clean_html.rb b/lib/docs/filters/nextjs/clean_html.rb index ab5d6164..6197de17 100644 --- a/lib/docs/filters/nextjs/clean_html.rb +++ b/lib/docs/filters/nextjs/clean_html.rb @@ -7,6 +7,7 @@ module Docs css('div:contains("NEWS:")').remove css('h2:contains("sponsors"), #sponsor-table').remove css('div.sticky').remove #remove the floating menu + css('div.-mt-4').remove #remove the navigation line css('footer').remove css('div.feedback_inlineTriggerWrapper__o7yUx').remove css('header').remove #remove links from the top of the page diff --git a/lib/docs/filters/nextjs/entries.rb b/lib/docs/filters/nextjs/entries.rb index fc785d1c..4e67f00d 100644 --- a/lib/docs/filters/nextjs/entries.rb +++ b/lib/docs/filters/nextjs/entries.rb @@ -4,7 +4,13 @@ module Docs def get_name name = at_css('h1').content name.strip! - name + #name + subpath_items = subpath.split('/', -1) + if subpath_items.length >= 5 + subpath_items[3].capitalize + ': ' + name # e.g. Routing: Defining Routes + else + name + end end def get_type @@ -16,8 +22,16 @@ module Docs 'Getting Started' elsif subpath.include?('/messages') 'Messages' + elsif subpath.include?('/app/building-your-application') + 'Using App Router: Building your application' + elsif subpath.include?('/app/api-reference') + 'Using App Router: api-reference' elsif subpath.include?('/app') 'Using App Router' + elsif subpath.include?('/pages/building-your-application') + 'Using Pages Router: Building your application' + elsif subpath.include?('/pages/api-reference') + 'Using Pages Router: api-reference' elsif subpath.include?('/pages') 'Using Pages Router' else