Skip to content

Commit

Permalink
Fix breadcrumbs nav path fix for index pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbaturin committed Jul 14, 2019
1 parent c018a5b commit c2e3c62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/soupault.ml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ let rec process_widgets settings env ws wh config soup =
last parent if the page is an index page.
*)
let fix_nav_path settings path page_name =
if page_name = settings.index_page then Utils.safe_tl path
if page_name = settings.index_page then Utils.drop_tail path
else path

(*
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ let safe_tl xs =
| [] -> []
| _ :: xs' -> xs'

(** Removes the last element of a list *)
let drop_tail xs = List.rev xs |> safe_tl |> List.rev

(** Unsafely unwraps an option type.
There are many places where None is easy to prove to not happen *)
let unwrap_option o =
Expand Down

0 comments on commit c2e3c62

Please sign in to comment.