just-the-docs 0.8.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a15da004d049b86d15dd69e15b26b4fdc3f89648f18c10a0887dcd74e11bbd33
4
- data.tar.gz: d6f522be1bd83f83c47d58da5a741742c041d145acf386a79d8df5b665128f71
3
+ metadata.gz: 555f04daa56535911096cb34c790bb8c8b89a617f398cbf93378954387ac1f1e
4
+ data.tar.gz: 873150f2912a9a83d170f2ceb98d725f507a39e49ebb990885887c4c980c4378
5
5
  SHA512:
6
- metadata.gz: 02c386ac5304ac727920556e0e35fe779f9a4420e01621353415f01ff55ac3550c3de08e4b41fdc76096b3639ad89d03bac9b65b3017b16acc2e99f257750383
7
- data.tar.gz: 63f6eea9e2b23b5d16da9314ba740b41c6be7f02aef860934c6b4c7935f43db2ca149b620f10dbdafa4c2cd7b18393de84ec03359266f313dcf2ce5dd2466cbf
6
+ metadata.gz: 5385791a026feeb7b51730f7bcd5bfc63afa4ca886467eea5bc443ce6de90cee66e4fa6b47747f8014830abfdaf21c138a65deae0f673205ebc0bc3c0a928375
7
+ data.tar.gz: 9285866faa3b41d50cd048a7ef587efc4f15fe7c8003c0e8d3387aa3538cf74692f501b780515df44011dd62fe7e91c46f1ec033dc7b1a0705a2c77b443849eb
data/CHANGELOG.md CHANGED
@@ -23,6 +23,95 @@ Docs changes made since the latest release:
23
23
 
24
24
  - N/A
25
25
 
26
+ ## Release v0.10.0
27
+
28
+ Hi folks! This minor release adds one of our most-requested features: unlimited multi-level navigation (also known as recursive navigation). Huge thanks to [@pdmosses] for his wonderful work in implementing this feature!
29
+
30
+ This release should be a straightforward upgrade for all users of Just the Docs. Thank you for your continued support!
31
+
32
+ ### Using Release `v0.10.0`
33
+
34
+ Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
35
+
36
+ To use this release explicitly as a remote theme:
37
+
38
+ ```yml
39
+ remote_theme: just-the-docs/just-the-docs@v0.10.0
40
+ ```
41
+
42
+ To use this version explicitly as a gem-based theme, pin the version in your `Gemfile` and re-run `bundle install` or `bundle update just-the-docs`:
43
+
44
+ ```ruby
45
+ gem "just-the-docs", "0.10.0"
46
+ ```
47
+
48
+ To use and pin a previous version of the theme, replace the `0.10.0` with the desired release tag.
49
+
50
+ ### New Features
51
+
52
+ - Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1431]
53
+
54
+ ### Documentation
55
+
56
+ - Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1440]
57
+ - Added: sitemap (via `jekyll-sitemap` plugin) by [@mattxwang] in [#1530]
58
+ - Fixed: (non-systemic) accessibility issues flagged by aXe by [@mattxwang] in [#1531]
59
+
60
+ [#1431]: https://github.com/just-the-docs/just-the-docs/pull/1431
61
+ [#1440]: https://github.com/just-the-docs/just-the-docs/pull/1440
62
+ [#1530]: https://github.com/just-the-docs/just-the-docs/pull/1530
63
+ [#1530]: https://github.com/just-the-docs/just-the-docs/pull/1531
64
+
65
+ ## Release v0.9.0
66
+
67
+ Hi folks! This minor release adds a `nav_enabled` set of variables to enable/disable the navigation at a site, layout, and page level --- and uses that to add search and auxilary links to the `minimal` layout. In addition, it fixes `search-data.json` corruption with default layouts and some minor CSS/SCSS issues.
68
+
69
+ This release should be a straightforward upgrade for all users of Just the Docs. Thank you for your continued support!
70
+
71
+ ### Using Release `v0.9.0`
72
+
73
+ Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
74
+
75
+ To use this release explicitly as a remote theme:
76
+
77
+ ```yml
78
+ remote_theme: just-the-docs/just-the-docs@v0.9.0
79
+ ```
80
+
81
+ To use this version explicitly as a gem-based theme, pin the version in your `Gemfile` and re-run `bundle install` or `bundle update just-the-docs`:
82
+
83
+ ```ruby
84
+ gem "just-the-docs", "0.9.0"
85
+ ```
86
+
87
+ To use and pin a previous version of the theme, replace the `0.9.0` with the desired release tag.
88
+
89
+ ### New Features
90
+
91
+ - Added: `nav_enabled` site, layout, and page-level variable to selectively show or hide the side/mobile menu by [@kevinlin1] in [#1441]
92
+ - Added: site-wide search bar and auxiliary links to the `minimal` layout by [@kevinlin1] in [#1441]
93
+
94
+ ### Bugfixes
95
+
96
+ - Fixed: protect `search-data.json` file from front matter default for layout by [@mattxwang] in [#1468]
97
+ - Fixed: Sass mixed declarations by [@bobvandevijver] in [#1495]
98
+ - Fixed: redundant `monospace` in `pre`, `code`, `kbd`, `samp` reset by [@mattxwang] in [#1508]
99
+
100
+ ### Documentation
101
+
102
+ - Docs: Explained the `nav_enabled` variables as an alternative to using the minimal layout [@kevinlin1] in [#1441].
103
+
104
+ ### New Contributors
105
+
106
+ - [@bobvandevijver] made their first contribution in [#1495]
107
+
108
+ [@bobvandevijver]: https://github.com/bobvandevijver
109
+
110
+ [#1441]: https://github.com/just-the-docs/just-the-docs/pull/1441
111
+ [#1468]: https://github.com/just-the-docs/just-the-docs/pull/1468
112
+ [#1495]: https://github.com/just-the-docs/just-the-docs/pull/1495
113
+ [#1508]: https://github.com/just-the-docs/just-the-docs/pull/1508
114
+
26
115
  ## Release v0.8.2
27
116
 
28
117
  Hi everyone! This patch release fixes a bug where a default layout with unrestricted `scope` (`path: ""`) breaks JavaScript functionality. Users who do not use a default layout with unrestricted `scope` should not be affected. This should be a straightforward upgrade for all users. Thank you to [@pdmosses] for triaging and fixing the bug!
@@ -551,7 +640,7 @@ We're so excited to release Just the Docs `v0.4.0`. This release has been almost
551
640
  - [callouts](https://just-the-docs.com/docs/ui-components/callouts/), a new design component to highlight content
552
641
  - [configuring mermaid.js](https://just-the-docs.com/docs/ui-components/code/#mermaid-diagram-code-blocks), a markdown-native diagram visualization library
553
642
  - [copy code button](https://just-the-docs.com/docs/ui-components/code/#copy-button) for code snippets
554
- - [external navigation links](https://just-the-docs.com/docs/navigation-structure/#external-navigation-links)
643
+ - external navigation links
555
644
  - major improvements to nav generation efficiency and robustness
556
645
  - minor improvements to built-in accessibility (SVG icons, nav titles, skip to main content)
557
646
  - [modularized site components](https://just-the-docs.com/docs/customization/#custom-layouts-and-includes) (advanced feature)
@@ -1,144 +1,96 @@
1
1
  {%- comment -%}
2
2
  Include as: {%- include components/breadcrumbs.html -%}
3
3
  Depends on: page, site.
4
+ Includes: components/site_nav.html.
4
5
  Results in: HTML for the breadcrumbs component.
5
6
  Overwrites:
6
- node, pages_list, parent_page, grandparent_page.
7
+ nav_list_link, site_nav, nav_list_simple, nav_list_link_class, nav_category,
8
+ nav_anchor_splits, nav_breadcrumbs, nav_split, nav_split_next, nav_split_test,
9
+ nav_breadcrumb_link, nav_list_end_less, nav_list_end_count, nav_end_index, nav_breadcrumb.
7
10
  {%- endcomment -%}
8
11
 
9
- {%- if page.url != "/" and page.parent -%}
12
+ {%- if page.url != "/" and page.parent and page.title -%}
10
13
 
11
14
  {%- capture nav_list_link -%}
12
15
  <a href="{{ page.url | relative_url }}" class="nav-list-link">
13
16
  {%- endcapture -%}
14
17
 
15
18
  {%- capture site_nav -%}
16
- {%- include_cached components/site_nav.html -%}
19
+ {%- include_cached components/site_nav.html all=true -%}
17
20
  {%- endcapture -%}
18
21
 
19
- {%- if site_nav contains nav_list_link -%}
20
-
21
- {%- capture nav_list_simple -%}
22
- <ul class="nav-list">
23
- {%- endcapture -%}
24
-
25
- {%- capture nav_list_link_class %} class="nav-list-link">
26
- {%- endcapture -%}
27
-
28
- {%- capture nav_category -%}
29
- <div class="nav-category">
30
- {%- endcapture -%}
31
-
32
- {%- assign nav_anchor_splits =
33
- site_nav | split: nav_list_link |
34
- first | split: nav_category |
35
- last | split: "</a>" -%}
36
-
37
- {%- comment -%}
38
- The ordinary pages (if any) and the collections pages (if any) are separated by
39
- occurrences of nav_category.
40
-
41
- Any ancestor nav-links of the page are contained in the last group of pages,
42
- immediately preceding nav-lists. After splitting at "</a>", the anchor that
43
- was split is a potential ancestor link when the following split starts with
44
- a nav-list.
45
-
46
- The array nav_breadcrumbs is the stack of current potential ancestors of the
47
- current page. A split that contains one or more "</ul>"s requires that number
48
- of potential ancestors to be popped from the stack.
49
-
50
- The number of occurrences of a string in nav_split_next is computed by removing
51
- them all, then dividing the resulting size difference by the length of the string.
52
- {%- endcomment %}
53
-
54
- {%- assign nav_breadcrumbs = "" | split: "" -%}
55
-
56
- {%- for nav_split in nav_anchor_splits -%}
57
- {%- unless forloop.last -%}
58
-
59
- {%- assign nav_split_next = nav_anchor_splits[forloop.index] | strip -%}
60
-
61
- {%- assign nav_split_test =
62
- nav_split_next | remove_first: nav_list_simple | prepend: nav_list_simple -%}
63
- {%- if nav_split_test == nav_split_next -%}
64
- {%- assign nav_breadcrumb_link =
65
- nav_split | split: "<a " | last | prepend: "<a " |
66
- replace: nav_list_link_class, ">" | append: "</a>" -%}
67
- {%- assign nav_breadcrumbs = nav_breadcrumbs | push: nav_breadcrumb_link -%}
68
- {%- endif -%}
69
-
70
- {%- if nav_split_next contains "</ul>" -%}
71
- {%- assign nav_list_end_less = nav_split_next | remove: "</ul>" -%}
72
- {%- assign nav_list_end_count =
73
- nav_split_next.size | minus: nav_list_end_less.size | divided_by: 5 -%}
74
- {% for nav_end_index in (1..nav_list_end_count) %}
75
- {%- assign nav_breadcrumbs = nav_breadcrumbs | pop -%}
76
- {%- endfor -%}
77
- {%- endif -%}
78
-
79
- {%- endunless -%}
80
- {%- endfor -%}
22
+ {%- capture nav_list_simple -%}
23
+ <ul class="nav-list">
24
+ {%- endcapture -%}
81
25
 
82
- {%- assign nav_parent_link = nav_breadcrumbs[-1] -%}
83
- {%- assign nav_grandparent_link = nav_breadcrumbs[-2] -%}
26
+ {%- capture nav_list_link_class %} class="nav-list-link">
27
+ {%- endcapture -%}
84
28
 
85
- {%- else -%}
29
+ {%- capture nav_category -%}
30
+ <div class="nav-category">
31
+ {%- endcapture -%}
86
32
 
87
- {%- comment -%}
88
- Pages whose links are excluded from the main navigation may still have
89
- breadcrumbs. Determining them appears to require inspecting the front matter
90
- of all the pages in the same group. For sites with 100s of pages, this is too
91
- inefficient in Jekyll 3 (also when the for-loop is replaced by where-filters).
92
- {%- endcomment -%}
33
+ {%- assign nav_anchor_splits =
34
+ site_nav | split: nav_list_link |
35
+ first | split: nav_category |
36
+ last | split: "</a>" -%}
93
37
 
94
- {%- assign pages_list = site[page.collection] | default: site.html_pages -%}
38
+ {%- comment -%}
39
+ The ordinary pages (if any) and the collections pages (if any) are separated by
40
+ occurrences of nav_category.
95
41
 
96
- {%- assign parent_page = nil -%}
97
- {%- assign grandparent_page = nil -%}
98
-
99
- {%- for node in pages_list -%}
42
+ Any ancestor nav-links of the page are contained in the last group of pages,
43
+ immediately preceding nav-lists. After splitting at "</a>", the anchor that
44
+ was split is a potential ancestor link when the following split starts with
45
+ a nav-list.
46
+
47
+ The array nav_breadcrumbs is the stack of current potential ancestors of the
48
+ current page. A split that contains one or more "</ul>"s requires that number
49
+ of potential ancestors to be popped from the stack.
100
50
 
101
- {%- if node.has_children and page.grand_parent -%}
51
+ The number of occurrences of a string in nav_split_next is computed by removing
52
+ them all, then dividing the resulting size difference by the length of the string.
53
+ {%- endcomment %}
102
54
 
103
- {%- if node.title == page.parent and node.parent == page.grand_parent -%}
104
- {%- assign parent_page = node -%}
105
- {%- endif -%}
106
- {%- if node.title == page.grand_parent -%}
107
- {%- assign grandparent_page = node -%}
108
- {%- endif -%}
109
- {%- if parent_page and grandparent_page -%}
110
- {%- break -%}
111
- {%- endif -%}
55
+ {%- assign nav_breadcrumbs = "" | split: "" -%}
112
56
 
113
- {%- elsif node.has_children and node.title == page.parent and node.parent == nil -%}
57
+ {%- for nav_split in nav_anchor_splits -%}
58
+ {%- unless forloop.last -%}
114
59
 
115
- {%- assign parent_page = node -%}
116
- {%- break -%}
60
+ {%- assign nav_split_next = nav_anchor_splits[forloop.index] | strip -%}
117
61
 
118
- {%- endif -%}
62
+ {%- assign nav_split_test =
63
+ nav_split_next | remove_first: nav_list_simple | prepend: nav_list_simple -%}
64
+ {%- if nav_split_test == nav_split_next -%}
65
+ {%- assign nav_breadcrumb_link =
66
+ nav_split | split: "<a " | last | prepend: "<a " |
67
+ replace: nav_list_link_class, ">" | append: "</a>" -%}
68
+ {%- assign nav_breadcrumbs = nav_breadcrumbs | push: nav_breadcrumb_link -%}
69
+ {%- endif -%}
119
70
 
71
+ {%- if nav_split_next contains "</ul>" -%}
72
+ {%- assign nav_list_end_less = nav_split_next | remove: "</ul>" -%}
73
+ {%- assign nav_list_end_count =
74
+ nav_split_next.size | minus: nav_list_end_less.size | divided_by: 5 -%}
75
+ {% for nav_end_index in (1..nav_list_end_count) %}
76
+ {%- assign nav_breadcrumbs = nav_breadcrumbs | pop -%}
120
77
  {%- endfor -%}
121
-
122
- {%- capture nav_parent_link -%}
123
- <a href="{{ parent_page.url | relative_url }}">{{ page.parent }}</a>
124
- {%- endcapture -%}
125
-
126
- {%- if page.grand_parent %}
127
- {%- capture nav_grandparent_link -%}
128
- <a href="{{ grandparent_page.url | relative_url }}">{{ page.grand_parent }}</a>
129
- {%- endcapture -%}
130
- {%- endif -%}
131
-
132
78
  {%- endif -%}
133
79
 
80
+ {%- endunless -%}
81
+ {%- endfor -%}
82
+
134
83
  <nav aria-label="Breadcrumb" class="breadcrumb-nav">
135
84
  <ol class="breadcrumb-nav-list">
136
- {%- if nav_grandparent_link %}
137
- <li class="breadcrumb-nav-list-item">{{ nav_grandparent_link }}</li>
138
- {%- endif %}
139
- <li class="breadcrumb-nav-list-item">{{ nav_parent_link }}</li>
85
+ {%- for nav_breadcrumb in nav_breadcrumbs %}
86
+ <li class="breadcrumb-nav-list-item">{{ nav_breadcrumb }}</li>
87
+ {%- endfor %}
140
88
  <li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
141
89
  </ol>
142
90
  </nav>
143
91
 
92
+ {% if site.nav_error_report %}
93
+ {{ nav_error_report }}
94
+ {% endif %}
95
+
144
96
  {%- endif -%}
@@ -1,33 +1,89 @@
1
1
  {%- comment -%}
2
2
  Include as: {%- include components/children_nav.html -%}
3
- Depends on: page, site.
3
+ Depends on: page, site, nav_breadcrumbs.
4
4
  Results in: HTML for the children-navigation component.
5
- Includes:
6
- sorted_pages.html
7
- toc_heading_custom.html
5
+ Includes: components/nav/sorted.html, toc_heading_custom.html.
8
6
  Overwrites:
9
- child_pages.
7
+ nav_ancestor_links, nav_top_node_titles, nav_child_candidates, nav_children,
8
+ nav_child, nav_child_ok, nav_child_ancestor, nav_sorted.
10
9
  {%- endcomment -%}
11
10
 
12
- {%- if page.has_children == true and page.has_toc != false -%}
13
- {%- assign child_pages = site[page.collection]
14
- | default: site.html_pages
15
- | where: "parent", page.title
16
- | where: "grand_parent", page.parent -%}
11
+ {%- comment -%}
12
+ Whether a page has any children is checked efficiently by inspecting the cached
13
+ site_nav. If the page has no children, nav_children is set to an empty array;
14
+ otherwise nav_children is left unset.
15
+ {%- endcomment -%}
17
16
 
18
- {%- include sorted_pages.html pages = child_pages -%}
17
+ {%- if page.has_children == false -%}
18
+ {%- assign nav_children = "" | split: "" -%}
19
+ {%- else -%}
19
20
 
20
- {%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%}
21
- {%- assign sorted_pages = sorted_pages | reverse -%}
21
+ {%- assign nav_children = nil -%}
22
+
23
+ {%- capture nav_list_link -%}
24
+ <a href="{{ page.url | relative_url }}" class="nav-list-link">
25
+ {%- endcapture -%}
26
+
27
+ {%- capture site_nav -%}
28
+ {%- include_cached components/site_nav.html all=true -%}
29
+ {%- endcapture -%}
30
+
31
+ {%- capture nav_list_simple -%}
32
+ <ul class="nav-list">
33
+ {%- endcapture -%}
34
+
35
+ {%- assign nav_child_start = site_nav
36
+ | split: nav_list_link | last
37
+ | split: "</a>" | slice: 1 | first -%}
38
+
39
+ {%- assign nav_child_test = nav_child_start
40
+ | remove_first: nav_list_simple | prepend: nav_list_simple -%}
41
+
42
+ {%- if nav_child_start != nav_child_test -%}
43
+ {%- assign nav_children = "" | split: "" -%}
22
44
  {%- endif -%}
45
+
23
46
  {%- endif -%}
24
47
 
48
+ {%- unless nav_children -%}
49
+
50
+ {%- comment -%}
51
+ The layout is assumed to include components/breadcrumbs.html before this file,
52
+ otherwise it needs to be included here.
53
+ {%- endcomment -%}
54
+
55
+ {%- assign nav_ancestors = "" | split: "" -%}
56
+ {%- for nav_link in nav_breadcrumbs -%}
57
+ {%- assign nav_title = nav_link | split: ">" | slice: 1 | first | append: ">" | remove: "</a>" -%}
58
+ {%- assign nav_ancestors = nav_ancestors | push: nav_title -%}
59
+ {%- endfor -%}
60
+
61
+ {%- assign nav_parenthood = site[page.collection] | default: site.html_pages
62
+ | where_exp: "item", "item.title != nil" | group_by: "parent" -%}
63
+
64
+ {%- assign nav_top_nodes = nav_parenthood
65
+ | where_exp: "item", "item.name == ''" | map: "items" | first -%}
66
+
67
+ {% assign nav_top_node_titles = nav_top_nodes | map: "title" -%}
68
+
69
+ {%- include components/nav/children.html node=page ancestors=nav_ancestors all=true -%}
70
+
71
+ {%- endunless -%}
72
+
73
+ {%- if nav_children.size >= 1 -%}
74
+
75
+ {%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%}
76
+ {%- assign nav_children = nav_children | reverse -%}
77
+ {%- endif -%}
78
+
25
79
  <hr>
26
80
  {% include toc_heading_custom.html %}
27
81
  <ul>
28
- {% for child in sorted_pages %}
82
+ {% for nav_child in nav_children %}
29
83
  <li>
30
- <a href="{{ child.url | relative_url }}">{{ child.title }}</a>{% if child.summary %} - {{ child.summary }}{% endif %}
84
+ <a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a>{% if nav_child.summary %} - {{ nav_child.summary }}{% endif %}
31
85
  </li>
32
- {% endfor %}
86
+ {% endfor %}
33
87
  </ul>
88
+
89
+ {%- endif -%}
@@ -0,0 +1,48 @@
1
+ {%- comment -%}
2
+ Include as: {%- include components/nav/children.html node=node ancestors=title_array all=bool -%}
3
+ Depends on: include.node, include.ancestors, include.all, nav_parenthood, nav_top_node_titles.
4
+ Includes: components/nav/sorted.html.
5
+ Assigns to: nav_children.
6
+ Overwrites:
7
+ nav_candidates, nav_child, nav_child_ok.
8
+ {%- endcomment -%}
9
+
10
+ {%- assign nav_children = "" | split: "" -%}
11
+
12
+ {%- if include.all == true or include.node.has_children != false -%}
13
+
14
+ {%- assign nav_candidates = nav_parenthood
15
+ | where: "name", include.node.title | map: "items" | first -%}
16
+
17
+ {%- for nav_child in nav_candidates -%}
18
+ {%- assign nav_child_ok = true -%}
19
+
20
+ {%- if nav_child.grand_parent and nav_child.grand_parent != include.node.parent -%}
21
+ {%- assign nav_child_ok = false -%}
22
+ {%- endif -%}
23
+
24
+ {%- if nav_child.ancestor and nav_child.ancestor != include.node.title -%}
25
+ {%- unless include.ancestors contains nav_child.ancestor -%}
26
+ {%- assign nav_child_ok = false -%}
27
+ {%- endunless -%}
28
+ {%- endif -%}
29
+
30
+ {%- comment -%}
31
+ The following check rejects nav_child as 3rd-level when include.node is 2nd-level
32
+ and nav_child can also be 2nd-level. This is for backwards compatibility with
33
+ existing 3-level sites.
34
+ {%- endcomment -%}
35
+ {%- if nav_child.grand_parent == nil and nav_child.ancestor == nil and
36
+ nav_top_node_titles contains nav_child.parent and include.ancestors.size >= 1 -%}
37
+ {%- assign nav_child_ok = false -%}
38
+ {%- endif -%}
39
+
40
+ {%- if nav_child_ok -%}
41
+ {%- assign nav_children = nav_children | push: nav_child -%}
42
+ {%- endif -%}
43
+ {%- endfor -%}
44
+
45
+ {%- endif -%}
46
+
47
+ {%- include components/nav/sorted.html pages=nav_children -%}
48
+ {%- assign nav_children = nav_sorted -%}
@@ -0,0 +1,53 @@
1
+ {%- comment -%}
2
+ Include as: {%- include components/nav/links.html pages=page_array ancestors=title_array all=bool -%}
3
+ Depends on: include.pages, include.ancestors, include.all.
4
+ Results in: HTML for the main navigation when all is nil or false;
5
+ includes links to pages excluded from the main navigation when all is true.
6
+ Includes: components/nav/sorted.html, components/nav/children.html, components/nav/links.html.
7
+ Overwrites:
8
+ node, nav_children, nav_ancestors.
9
+ {%- endcomment -%}
10
+
11
+ <ul class="nav-list">
12
+ {%- for node in include.pages -%}
13
+ {%- if include.all == true or node.nav_exclude != true -%}
14
+
15
+ {%- if include.ancestors contains node.title -%}
16
+
17
+ <li class="nav-list-item">
18
+ <a href="{{ node.url | relative_url }}" class="nav-list-link"> ∞ </a>
19
+ </li>
20
+ {%- capture nav_error_report -%}
21
+ <blockquote class="warning">
22
+ A page has the same title as its parent page or one of its ancestral pages!<br>
23
+ This causes an incorrect link in the main navigation panel.<br>
24
+ Page title: <code>{{ node.title }}</code>, location: <code>{{ node.path }}</code>.
25
+ </blockquote>
26
+ {%- endcapture -%}
27
+
28
+ {%- else -%}
29
+
30
+ {%- include components/nav/children.html node=node ancestors=include.ancestors all=include.all -%}
31
+
32
+ <li class="nav-list-item">
33
+ {%- if nav_children.size >= 1 -%}
34
+ <button class="nav-list-expander btn-reset" aria-label="toggle items in {{ node.title }} category" aria-pressed="false">
35
+ <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
36
+ </button>
37
+ {%- endif -%}
38
+ <a href="{{ node.url | relative_url }}" class="nav-list-link">{{ node.title }}</a>
39
+ {%- if nav_children.size >= 1 -%}
40
+ {%- if node.child_nav_order == 'desc' or node.child_nav_order == 'reversed' -%}
41
+ {%- assign nav_children = nav_children | reverse -%}
42
+ {%- endif -%}
43
+ {%- assign nav_ancestors = include.ancestors | push: node.title -%}
44
+ {%- include components/nav/links.html pages=nav_children ancestors=nav_ancestors all=include.all -%}
45
+ {%- endif -%}
46
+ </li>
47
+
48
+ {%- endif -%}
49
+
50
+ {%- endif -%}
51
+ {%- endfor -%}
52
+ </ul>
53
+ {%- comment -%}{%- endcomment -%}
@@ -0,0 +1,23 @@
1
+ {%- comment -%}
2
+ Include as: {%- include components/nav/pages.html pages=page_array all=bool -%}
3
+ Depends on: include.pages.
4
+ Results in: HTML for the main navigation when all is nil or false;
5
+ adds links to pages excluded from the main navigation when all is true.
6
+ Includes: components/nav/links.html
7
+ Assigns to:
8
+ nav_parenthood, nav_top_nodes, nav_top_node_titles, nav_ancestors.
9
+ {%- endcomment -%}
10
+
11
+ {%- assign nav_parenthood = include.pages
12
+ | where_exp: "item", "item.title != nil" | group_by: "parent" -%}
13
+
14
+ {%- assign nav_top_nodes = nav_parenthood
15
+ | where_exp: "item", "item.name == ''" | map: "items" | first -%}
16
+
17
+ {%- include components/nav/sorted.html pages=nav_top_nodes -%}
18
+
19
+ {% assign nav_top_node_titles = nav_top_nodes | map: "title" -%}
20
+
21
+ {%- assign nav_ancestors = "" | split: "" -%}
22
+
23
+ {%- include components/nav/links.html pages=nav_sorted ancestors=nav_ancestors all=include.all -%}
@@ -1,7 +1,7 @@
1
1
  {%- comment -%}
2
- Include as: {%- include sorted_pages.html pages=array_of_pages -%}
2
+ Include as: {%- include components/nav/sorted.html pages=page_array -%}
3
3
  Depends on: include.pages.
4
- Assigns to: sorted_pages.
4
+ Assigns to: nav_sorted.
5
5
  Overwrites:
6
6
  nav_order_pages, title_order_pages, double_quote, empty_array,
7
7
  nav_number_pages, nav_string_pages, nav_order_groups, group,
@@ -103,7 +103,7 @@
103
103
  {%- endif -%}
104
104
  {%- endunless -%}
105
105
 
106
- {%- assign sorted_pages = nav_number_pages
106
+ {%- assign nav_sorted = nav_number_pages
107
107
  | concat: nav_string_pages
108
108
  | concat: title_number_pages
109
109
  | concat: title_string_pages -%}
@@ -1,9 +1,10 @@
1
1
  {%- comment -%}
2
- Include as: {%- include_cached components/site_nav.html -%}
2
+ Include as: {%- include_cached components/site_nav.html all=bool -%}
3
3
  Depends on: site.
4
- Results in: HTML for the site-nav.
4
+ Results in: cached HTML for the main navigation when `all` is nil or false;
5
+ includes links to pages excluded from the main navigation when `all` is true.
5
6
  Includes:
6
- components/nav.html
7
+ components/nav/pages.html
7
8
  Overwrites:
8
9
  pages_top_size, collections_size, collection_entry,
9
10
  collection_key, collection_value, collection.
@@ -16,7 +17,7 @@
16
17
  | where_exp:"item", "item.nav_exclude != true"
17
18
  | size %}
18
19
  {% if pages_top_size > 0 %}
19
- {% include components/nav.html pages=site.html_pages %}
20
+ {% include components/nav/pages.html pages=site.html_pages all=include.all %}
20
21
  {% endif %}
21
22
  {%- if site.nav_external_links -%}
22
23
  <ul class="nav-list">
@@ -51,17 +52,21 @@
51
52
  </button>
52
53
  {%- endif -%}
53
54
  <div class="nav-category">{{ collection_value.name }}</div>
54
- {% include components/nav.html pages=collection %}
55
+ {% include components/nav/pages.html pages=collection all=include.all %}
55
56
  </li>
56
57
  </ul>
57
58
  {% else %}
58
59
  <div class="nav-category">{{ collection_value.name }}</div>
59
- {% include components/nav.html pages=collection %}
60
+ {% include components/nav/pages.html pages=collection all=include.all %}
60
61
  {% endif %}
61
62
  {% else %}
62
- {% include components/nav.html pages=collection %}
63
+ {% include components/nav/pages.html pages=collection all=include.all %}
63
64
  {% endif %}
64
65
  {% endif %}
65
66
  {% endfor %}
66
67
  {% endif %}
67
68
  </nav>
69
+
70
+ {% if site.nav_error_report %}
71
+ {{ nav_error_report }}
72
+ {%- endif %}