|
2 | 2 | <nav id="tree">
|
3 | 3 | {# Walk 'Up' the ancestor path to show the page-tree #}
|
4 | 4 | {%- for ancestor_path in page_or_section.ancestors | default(value=[]) -%}
|
5 |
| - <ul> |
6 |
| - {# Each ancestor will have an index (linked in the next loop as that ancestor link), pages, and sections #} |
7 |
| - {%- set ancestor = get_section(path=ancestor_path) -%} |
8 |
| - {# We do pages first as they are the 'main content' for an ancestor, sections tend to be 'Sub-ideas' #} |
9 |
| - {%- for ancestor_page in ancestor.pages | default(value=[]) -%} |
10 |
| - {%- set is_descendant = page_or_section.ancestors is containing(ancestor_page.relative_path) -%} |
11 |
| - {%- set is_current = page_or_section == ancestor_page -%} |
12 |
| - {%- if ancestor_page.extra.in_menu | default(value=false) or is_descendant -%} |
13 |
| - <li> |
14 |
| - <a |
15 |
| - {% if is_descendant -%} class="ancestor" {%- endif %} |
16 |
| - {% if is_current -%} class="current" {%- endif %} |
17 |
| - href="{{ ancestor_page.permalink | safe }}" |
18 |
| - > |
19 |
| - {{ ancestor_page.title | markdown(inline=true) }} |
20 |
| - </a> |
21 |
| - </li> |
22 |
| - {%- endif -%} |
23 |
| - {%- endfor -%} |
| 5 | + <ul> |
| 6 | + {# Each ancestor will have an index (linked in the next loop as that ancestor link), pages, and sections #} |
| 7 | + {%- set ancestor = get_section(path=ancestor_path) -%} |
| 8 | + {# We do pages first as they are the 'main content' for an ancestor, sections tend to be 'Sub-ideas' #} |
| 9 | + {%- for ancestor_page in ancestor.pages | default(value=[]) -%} |
| 10 | + {%- set is_descendant = page_or_section.ancestors is containing(ancestor_page.relative_path) -%} |
| 11 | + {%- set is_current = page_or_section == ancestor_page -%} |
| 12 | + {%- if ancestor_page.extra.in_menu | default(value=false) or is_descendant -%} |
| 13 | + <li> |
| 14 | + <a |
| 15 | + {% if is_descendant -%} class="ancestor" {%- endif %} |
| 16 | + {% if is_current -%} class="current" {%- endif %} |
| 17 | + href="{{ ancestor_page.permalink | safe }}" |
| 18 | + > |
| 19 | + {{ ancestor_page.title | markdown(inline=true) }} |
| 20 | + </a> |
| 21 | + </li> |
| 22 | + {%- endif -%} |
| 23 | + {%- endfor -%} |
24 | 24 |
|
25 |
| - {# Now sections, the 'Sub-ideas' -- these may have their own descendants #} |
26 |
| - {%- for ancestor_section_path in ancestor.subsections -%} |
27 |
| - {%- set ancestor_section = get_section(path=ancestor_section_path) -%} |
28 |
| - {%- set is_descendant = page_or_section.ancestors is containing(ancestor_section.relative_path) -%} |
29 |
| - {%- set is_current = page_or_section == ancestor_section -%} |
30 |
| - {%- if ancestor_section.extra.in_menu | default(value=false) or is_descendant -%} |
31 |
| - <li> |
32 |
| - <a |
33 |
| - {% if is_descendant -%} class="ancestor" {%- endif %} |
34 |
| - {% if is_current -%} class="current" {%- endif %} |
35 |
| - href="{{ ancestor_section.permalink | safe }}" |
36 |
| - > |
37 |
| - {{ ancestor_section.title | markdown(inline=true) }} |
38 |
| - </a> |
39 |
| - </li> |
40 |
| - {%- endif -%} |
41 |
| - {%- endfor -%} |
42 |
| - </ul> |
| 25 | + {# Now sections, the 'Sub-ideas' -- these may have their own descendants #} |
| 26 | + {%- for ancestor_section_path in ancestor.subsections -%} |
| 27 | + {%- set ancestor_section = get_section(path=ancestor_section_path) -%} |
| 28 | + {%- set is_descendant = page_or_section.ancestors is containing(ancestor_section.relative_path) -%} |
| 29 | + {%- set is_current = page_or_section == ancestor_section -%} |
| 30 | + {%- if ancestor_section.extra.in_menu | default(value=false) or is_descendant or is_current -%} |
| 31 | + <li> |
| 32 | + <a |
| 33 | + {% if is_descendant -%} class="ancestor" {%- endif %} |
| 34 | + {% if is_current -%} class="current" {%- endif %} |
| 35 | + href="{{ ancestor_section.permalink | safe }}" |
| 36 | + > |
| 37 | + {{ ancestor_section.title | markdown(inline=true) }} |
| 38 | + </a> |
| 39 | + </li> |
| 40 | + {%- endif -%} |
| 41 | + {%- endfor -%} |
| 42 | + </ul> |
43 | 43 | {%- endfor -%}
|
44 | 44 | <ul>
|
45 | 45 | {# Next, we show the line for the 'current' items pages (the 'main content'), then sections (the 'Sub-ideas') #}
|
|
0 commit comments