History

get nextjs types by subpath, removed the sticky menu

Yen Ton committed 2 years ago

Commit a1d4f871 parent deb5f812 files · +27 −10Browse files

Unified · Split

2 files
  1. lib/docs/filters/nextjs/clean_html.rb +2 −1
  2. lib/docs/filters/nextjs/entries.rb +25 −9
lib/docs/filters/nextjs/clean_html.rb+2−1
@@ -3,9 +3,10 @@ module Docs · 2 unmodified lines
3 class CleanHtmlFilter < Filter3 class CleanHtmlFilter < Filter
4 def call4 def call
5 css('.zola-anchor').remove5 css('.zola-anchor').remove
6 doc.prepend_child("<h1>NextJS</h1>") if root_page?6 doc.prepend_child("<h1>NextJS2</h1>") if root_page?
7 css('div:contains("NEWS:")').remove7 css('div:contains("NEWS:")').remove
8 css('h2:contains("sponsors"), #sponsor-table').remove8 css('h2:contains("sponsors"), #sponsor-table').remove
9 css('div.sticky').remove #remove the floating menu
9 doc10 doc
10 end11 end
11 end12 end
lib/docs/filters/nextjs/entries.rb+25−9
@@ -1,13 +1,29 @@
1module Docs1module Docs
2 class Nextjs2 class Nextjs
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_name4 def get_name
5 at_css('h1').content5 name = at_css('h1').content
6 end6 name.strip!
7 name
8 end
7 9
8 def get_type10 def get_type
9 get_name11 if subpath.include?('/architecture')
10 end12 'Architecture'
13 elsif subpath.include?('/community')
14 'Community'
15 elsif subpath.include?('/getting-started')
16 'Getting Started'
17 elsif subpath.include?('/messages')
18 'Messages'
19 elsif subpath.include?('/app')
20 'Using App Router'
21 elsif subpath.include?('/pages')
22 'Using Pages Router'
23 else
24 get_name
11 end25 end
26 end
12 end27 end
13end28 end
29end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t