Skip to content

Commit

Permalink
Add log messages about index_first passes and fake pages
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbaturin committed Aug 26, 2023
1 parent 0199e9a commit 3a0e790
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/soupault.ml
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ let main cli_options =
It also often (though not always) reduces the number of widgets that will run on each page
because widgets that aren't in the [extract_after_widgets] list are not processed.
*)
let () = Logs.info @@ fun m -> m "Starting the first (index extraction only) pass" in
let state = {state with soupault_settings={state.soupault_settings with index_only=true}} in
let* index = process_page_files state index_hash widgets hooks page_files in
(* Sort entries according to the global settings so that widgets that use index data
Expand All @@ -1014,12 +1015,14 @@ let main cli_options =
they will simply return empty lists.
*)
let state = {state with soupault_settings={state.soupault_settings with no_index_extraction=true; index_only=false}} in
let () = Logs.info @@ fun m -> m "Starting the second (full page rendering) pass" in
(* At this step Lua index_processors may generate new pages, e.g. for taxonomies or pagination. *)
let* new_pages = process_index_files state index index_hash widgets hooks all_files in
(* Now process those "fake" pages generated by index processors.
Index processing must be disabled on them to prevent index processors from generating
new "fake" pages from generated pages and creating infinite loops.
*)
let () = if new_pages <> [] then Logs.info @@ fun m -> m "Processing pages generated by indexer scripts" in
let state = {state with soupault_settings={state.soupault_settings with index=false}} in
let* () = Utils.iter_result (process_page state index index_hash widgets hooks) new_pages in
(* Finally, dump the index file, if requested. *)
Expand Down Expand Up @@ -1055,6 +1058,7 @@ let main cli_options =
new "fake" pages from generated pages and creating infinite loops.
*)
let state = {state with soupault_settings={state.soupault_settings with index=false}} in
let () = if new_pages <> [] then Logs.info @@ fun m -> m "Processing pages generated by indexer scripts" in
let* () = Utils.iter_result (process_page state index index_hash widgets hooks) new_pages in
(* Finally, dump the index file, if requested. *)
let* () = dump_index_json settings index in
Expand Down

0 comments on commit 3a0e790

Please sign in to comment.