@@ -2,25 +2,25 @@ module Docs
2
2
class Astro
3
3
class EntriesFilter < Docs ::EntriesFilter
4
4
def get_name
5
- name = at_css ( 'article h1 ' ) . content
6
- name . sub! %r{ \s *#\s *} , ''
5
+ name = at_css ( 'h1' ) ? at_css ( 'h1' ) . content : at_css ( 'h2 ') . content
6
+ name . sub! ( / \s *#\s */ , '' )
7
7
name
8
8
end
9
9
10
10
def get_type
11
- return 'Guides' if slug . start_with? ( 'contribute/' )
12
- return 'Guides' if slug . start_with? ( 'guides/' )
13
- aside = at_css ( 'aside' )
14
- a = aside . at_css ( 'a[aria-current="page"]' , 'a[data-current-parent="true"]' )
15
- a . ancestors ( 'details' ) . at_css ( 'summary' ) . content
11
+ return 'Contribute' if slug . start_with? ( 'contribute/' )
12
+
13
+ a = at_css ( 'a[aria-current="page"]' )
14
+ a ? a . content : 'Other'
16
15
end
17
16
18
17
def additional_entries
19
18
return [ ] if slug . start_with? ( 'guides/deploy' )
20
19
return [ ] if slug . start_with? ( 'guides/integrations-guide' )
21
- at_css ( 'article' ) . css ( 'h2[id], h3[id]' ) . each_with_object [ ] do |node , entries |
20
+
21
+ at_css ( 'main' ) . css ( 'h2[id], h3[id]' ) . each_with_object [ ] do |node , entries |
22
22
type = node . content . strip
23
- type . sub! %r{ \s *#\s *} , ''
23
+ type . sub! ( / \s *#\s */ , '' )
24
24
entries << [ "#{ name } : #{ type } " , node [ 'id' ] ]
25
25
end
26
26
end
0 commit comments