Skip to content

Commit

Permalink
Move pages filtering in a separate loop
Browse files Browse the repository at this point in the history
  • Loading branch information
moisseev committed Apr 15, 2024
1 parent 51261c2 commit e071afe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions _includes/directory-tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
{%- assign dir_strong_closing = "</strong>" -%}
{%- endif -%}
{%- assign prev_page_dir = include.dir -%}
{%- assign sorted_pages = site.pages | sort: "dir" -%}
{%- for pg in sorted_pages -%}
{%- assign filtered_pages = "" | split: "," -%}
{%- for pg in site.pages -%}
{%- comment -%}
# Skip page unless its directory starts with include.dir.
{%- endcomment -%}
Expand All @@ -52,6 +52,10 @@
{%- if pg.layout == nil or pg.layout == 'none' or pg.dir contains '/blog/page' -%}
{%- continue -%}
{%- endif -%}
{%- assign filtered_pages = filtered_pages | push: pg -%}
{%- endfor -%}
{%- assign sorted_pages = filtered_pages | sort: "dir" -%}
{%- for pg in sorted_pages -%}
{% unless pg.dir == prev_page_dir -%}
{%- assign path = pg.dir | split: "/" -%}
{%- comment -%}
Expand Down

0 comments on commit e071afe

Please sign in to comment.