Skip to content

Commit

Permalink
Sort subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
moisseev committed Apr 15, 2024
1 parent e071afe commit 1c18611
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions _includes/directory-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
{%- assign dir_strong = "<strong>" -%}
{%- assign dir_strong_closing = "</strong>" -%}
{%- endif -%}
{%- assign prev_page_dir = include.dir -%}
{%- assign filtered_pages = "" | split: "," -%}
{%- for pg in site.pages -%}
{%- comment -%}
Expand All @@ -54,7 +53,21 @@
{%- endif -%}
{%- assign filtered_pages = filtered_pages | push: pg -%}
{%- endfor -%}
{%- assign sorted_pages = filtered_pages | sort: "dir" -%}
{%- assign sorted_by_dir = filtered_pages | sort: "dir" -%}
{%- assign subdir_pages = "" | split: "," -%}
{%- for pg in sorted_by_dir -%}
{%- if pg.dir == prev_page_dir -%}
{%- assign subdir_pages = subdir_pages | push: pg -%}
{%- else -%}
{%- assign sorted_subdir_pages = subdir_pages | sort: "dir" -%}
{%- assign sorted_pages = sorted_pages | push: sorted_subdir_pages -%}
{%- assign subdir_pages = "" | split: "," | push: pg -%}
{%- assign prev_page_dir = pg.dir -%}
{%- endif -%}
{%- endfor -%}
{%- assign sorted_subdir_pages = subdir_pages | sort: "dir" -%}
{%- assign sorted_pages = sorted_pages | push: sorted_subdir_pages -%}
{%- assign prev_page_dir = include.dir -%}
{%- for pg in sorted_pages -%}
{% unless pg.dir == prev_page_dir -%}
{%- assign path = pg.dir | split: "/" -%}
Expand Down

0 comments on commit 1c18611

Please sign in to comment.