File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 19
19
indexers [ site ] . finish
20
20
end
21
21
22
- Jekyll ::Hooks . register :posts , :post_render do |post |
22
+ # gets random pages like your home page
23
+ Jekyll ::Hooks . register :pages , :post_render do |page |
23
24
# strip html
24
- nokogiri_doc = Nokogiri ::HTML ( post . output )
25
+ nokogiri_doc = Nokogiri ::HTML ( page . output )
25
26
26
- puts %(indexing #{ post . url } )
27
+ puts %( indexing page #{ page . url } )
27
28
28
- indexer = indexers [ post . site ]
29
- indexer << post . data . merge ( {
30
- id : post . id ,
31
- url : post . url ,
29
+ indexer = indexers [ page . site ]
30
+ indexer << page . data . merge ( {
31
+ id : page . name ,
32
+ url : page . url ,
33
+ text : nokogiri_doc . xpath ( "//article//text()" ) . to_s . gsub ( /\s +/ , " " )
34
+ } )
35
+ end
36
+
37
+ # gets both posts and collections
38
+ Jekyll ::Hooks . register :documents , :post_render do |document |
39
+ # strip html
40
+ nokogiri_doc = Nokogiri ::HTML ( document . output )
41
+
42
+ puts %( indexing document #{ document . url } )
43
+
44
+ indexer = indexers [ document . site ]
45
+ indexer << document . data . merge ( {
46
+ id : document . id ,
47
+ url : document . url ,
32
48
text : nokogiri_doc . xpath ( "//article//text()" ) . to_s . gsub ( /\s +/ , " " )
33
49
} )
34
50
end
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ def finalize!
162
162
163
163
# delete old indices
164
164
cleanup_indices = http_delete ( "/#{ old_indices . join ( ',' ) } " )
165
- print %(Old indices: #{ old_indices } )
165
+ puts %( Old indices: #{ old_indices . join ( ', ' ) } )
166
166
167
167
# run the prepared requests
168
168
http_start do |http |
You can’t perform that action at this time.
0 commit comments