just-the-docs 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce292fe4d8d3ed40611eb39229671ef8e38e86134e288d54c7e9f93412c4eedc
4
- data.tar.gz: fc63da23207b3c16826bd634257efa1becc71abb2a2a3004a92f9136a52b04ad
3
+ metadata.gz: 699cb64eadf9b3149580ea5751976d46c49a461437731e59b8e38ee65805c745
4
+ data.tar.gz: e797cc9bea526d75c794feb3b392e4721f5d3de5b6f33ea86dc6a4ac1e068a60
5
5
  SHA512:
6
- metadata.gz: 811ca2371d262ed21c7009f7fcb86811274bdb8d42e64960fe32be6adab4a63a734d3561a8b3011b24d3601c91516cbb70fd1533200d125cc1771a380fba0ca8
7
- data.tar.gz: 33ee2161b4b212f16e42e2d1c858004a8c06860a69efe7d5ff673a8217bd44b5d657465bbe7336593f45adb040991ddb0a369aaba6104e10d00d80560e79e249
6
+ metadata.gz: 8fcba642e7b774f78fdd8a68427a74161ecebbbf6b89cd3c0c38f2dd98c8a3c11c099bfb8d1012dbdc4b80ec4845d65704f8046ec05994e061ff708ccc9f4d03
7
+ data.tar.gz: c8381ca89fcbcf87f47495db27d9a35574d1643678888d6c52cfc412a6a2e186f712378185beb08846b3a46b94a114ea1542131630dcc35b88aa1e2398e61a7c
data/CHANGELOG.md CHANGED
@@ -23,6 +23,74 @@ Docs changes made since the latest release:
23
23
 
24
24
  - N/A
25
25
 
26
+ ## Release v0.10.1
27
+
28
+ Hi folks! This patch fixes two bugs related to generated navigation elements and improves our docs.
29
+
30
+ This release should be a straightforward upgrade for all users of Just the Docs. Thank you for your continued support!
31
+
32
+ ### Bugfixes
33
+
34
+ - Fixed: `back_to_top` not displaying when no other footer variables are set by [@mattxwang] in [#1461]
35
+ - Fixed: auto-generated child navigation (TOC) by [@pdmosses] in [#1590]
36
+
37
+ ### Documentation
38
+
39
+ - Fixed: incorrect docs for example with minimal layout parent, default layout child by [@janbrasna] in [#1540]
40
+ - Fixed: unclear docs on using in-page table of contents by [@sebjameswml] in [#1551]
41
+
42
+ ### New Contributors
43
+
44
+ - [@janbrasna] made their first contribution in [#1540]
45
+ - [@sebjameswml] made their first contribution in [#1551]
46
+
47
+ [@janbrasna]: https://github.com/janbrasna
48
+ [@sebjameswml]: https://github.com/sebjameswml
49
+
50
+ [#1461]: https://github.com/just-the-docs/just-the-docs/pull/1461
51
+ [#1540]: https://github.com/just-the-docs/just-the-docs/pull/1540
52
+ [#1551]: https://github.com/just-the-docs/just-the-docs/pull/1551
53
+ [#1590]: https://github.com/just-the-docs/just-the-docs/pull/1590
54
+
55
+ ## Release v0.10.0
56
+
57
+ 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!
58
+
59
+ This release should be a straightforward upgrade for all users of Just the Docs. Thank you for your continued support!
60
+
61
+ ### Using Release `v0.10.0`
62
+
63
+ Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
64
+
65
+ To use this release explicitly as a remote theme:
66
+
67
+ ```yml
68
+ remote_theme: just-the-docs/just-the-docs@v0.10.0
69
+ ```
70
+
71
+ 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`:
72
+
73
+ ```ruby
74
+ gem "just-the-docs", "0.10.0"
75
+ ```
76
+
77
+ To use and pin a previous version of the theme, replace the `0.10.0` with the desired release tag.
78
+
79
+ ### New Features
80
+
81
+ - Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1431]
82
+
83
+ ### Documentation
84
+
85
+ - Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1440]
86
+ - Added: sitemap (via `jekyll-sitemap` plugin) by [@mattxwang] in [#1530]
87
+ - Fixed: (non-systemic) accessibility issues flagged by aXe by [@mattxwang] in [#1531]
88
+
89
+ [#1431]: https://github.com/just-the-docs/just-the-docs/pull/1431
90
+ [#1440]: https://github.com/just-the-docs/just-the-docs/pull/1440
91
+ [#1530]: https://github.com/just-the-docs/just-the-docs/pull/1530
92
+ [#1530]: https://github.com/just-the-docs/just-the-docs/pull/1531
93
+
26
94
  ## Release v0.9.0
27
95
 
28
96
  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.
@@ -31,7 +99,7 @@ This release should be a straightforward upgrade for all users of Just the Docs.
31
99
 
32
100
  ### Using Release `v0.9.0`
33
101
 
34
- Users who have not pinned the theme version will be **automatically upgraded to `v0.8.0` the next time they build their site**.
102
+ Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
35
103
 
36
104
  To use this release explicitly as a remote theme:
37
105
 
@@ -601,7 +669,7 @@ We're so excited to release Just the Docs `v0.4.0`. This release has been almost
601
669
  - [callouts](https://just-the-docs.com/docs/ui-components/callouts/), a new design component to highlight content
602
670
  - [configuring mermaid.js](https://just-the-docs.com/docs/ui-components/code/#mermaid-diagram-code-blocks), a markdown-native diagram visualization library
603
671
  - [copy code button](https://just-the-docs.com/docs/ui-components/code/#copy-button) for code snippets
604
- - [external navigation links](https://just-the-docs.com/docs/navigation-structure/#external-navigation-links)
672
+ - external navigation links
605
673
  - major improvements to nav generation efficiency and robustness
606
674
  - minor improvements to built-in accessibility (SVG icons, nav titles, skip to main content)
607
675
  - [modularized site components](https://just-the-docs.com/docs/customization/#custom-layouts-and-includes) (advanced feature)
data/README.md CHANGED
@@ -32,7 +32,7 @@ More specifically, the created site:
32
32
 
33
33
  Other than that, you're free to customize sites that you create with the template, however you like. You can easily change the versions of `just-the-docs` and Jekyll it uses, as well as adding further plugins.
34
34
 
35
- ### Use RubyGems
35
+ ### Use as a Ruby Gem
36
36
 
37
37
  Alternatively, you can install the theme as a Ruby Gem, without creating a new site.
38
38
 
@@ -48,17 +48,11 @@ And add this line to your Jekyll site's `_config.yml`:
48
48
  theme: just-the-docs
49
49
  ```
50
50
 
51
- And then execute:
51
+ And then install all relevant dependencies:
52
52
 
53
- $ bundle
54
-
55
- Or install it yourself as:
56
-
57
- $ gem install just-the-docs
58
-
59
- Alternatively, you can run it inside Docker while developing your site
60
-
61
- $ docker-compose up
53
+ ```shell
54
+ $ bundle
55
+ ```
62
56
 
63
57
  ## Usage
64
58
 
@@ -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 -%}
13
+
14
+ {%- capture site_nav -%}
15
+ {%- include_cached components/site_nav.html all=true -%}
16
+ {%- endcapture -%}
10
17
 
11
18
  {%- capture nav_list_link -%}
12
19
  <a href="{{ page.url | relative_url }}" class="nav-list-link">
13
20
  {%- endcapture -%}
14
21
 
15
- {%- capture site_nav -%}
16
- {%- include_cached components/site_nav.html -%}
22
+ {%- capture nav_list_simple -%}
23
+ <ul class="nav-list">
17
24
  {%- endcapture -%}
18
25
 
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 -%}
81
-
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,90 @@
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. (The site_nav is rendered the first time
15
+ it is included, and that may overwrite various variables.)
16
+ {%- endcomment -%}
17
17
 
18
- {%- include sorted_pages.html pages = child_pages -%}
18
+ {%- if page.has_children == false -%}
19
+ {%- assign nav_children = "" | split: "" -%}
20
+ {%- else -%}
19
21
 
20
- {%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%}
21
- {%- assign sorted_pages = sorted_pages | reverse -%}
22
+ {%- capture site_nav -%}
23
+ {%- include_cached components/site_nav.html all=true -%}
24
+ {%- endcapture -%}
25
+
26
+ {%- assign nav_children = nil -%}
27
+
28
+ {%- capture nav_list_link -%}
29
+ <a href="{{ page.url | relative_url }}" class="nav-list-link">
30
+ {%- endcapture -%}
31
+
32
+ {%- capture nav_list_simple -%}
33
+ <ul class="nav-list">
34
+ {%- endcapture -%}
35
+
36
+ {%- assign nav_child_start = site_nav
37
+ | split: nav_list_link | last
38
+ | split: "</a>" | slice: 1 | first -%}
39
+
40
+ {%- assign nav_child_test = nav_child_start
41
+ | remove_first: nav_list_simple | prepend: nav_list_simple -%}
42
+
43
+ {%- if nav_child_start != nav_child_test -%}
44
+ {%- assign nav_children = "" | split: "" -%}
22
45
  {%- endif -%}
46
+
23
47
  {%- endif -%}
24
48
 
49
+ {%- unless nav_children -%}
50
+
51
+ {%- comment -%}
52
+ The layout is assumed to include components/breadcrumbs.html before this file,
53
+ otherwise it needs to be included here.
54
+ {%- endcomment -%}
55
+
56
+ {%- assign nav_ancestors = "" | split: "" -%}
57
+ {%- for nav_link in nav_breadcrumbs -%}
58
+ {%- assign nav_title = nav_link | split: ">" | slice: 1 | first | append: ">" | remove: "</a>" -%}
59
+ {%- assign nav_ancestors = nav_ancestors | push: nav_title -%}
60
+ {%- endfor -%}
61
+
62
+ {%- assign nav_parenthood = site[page.collection] | default: site.html_pages
63
+ | where_exp: "item", "item.title != nil" | group_by: "parent" -%}
64
+
65
+ {%- assign nav_top_nodes = nav_parenthood
66
+ | where_exp: "item", "item.name == ''" | map: "items" | first -%}
67
+
68
+ {% assign nav_top_node_titles = nav_top_nodes | map: "title" -%}
69
+
70
+ {%- include components/nav/children.html node=page ancestors=nav_ancestors all=true -%}
71
+
72
+ {%- endunless -%}
73
+
74
+ {%- if nav_children.size >= 1 -%}
75
+
76
+ {%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%}
77
+ {%- assign nav_children = nav_children | reverse -%}
78
+ {%- endif -%}
79
+
25
80
  <hr>
26
81
  {% include toc_heading_custom.html %}
27
82
  <ul>
28
- {% for child in sorted_pages %}
83
+ {% for nav_child in nav_children %}
29
84
  <li>
30
- <a href="{{ child.url | relative_url }}">{{ child.title }}</a>{% if child.summary %} - {{ child.summary }}{% endif %}
85
+ <a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a>{% if nav_child.summary %} - {{ nav_child.summary }}{% endif %}
31
86
  </li>
32
- {% endfor %}
87
+ {% endfor %}
33
88
  </ul>
89
+
90
+ {%- endif -%}
@@ -1,7 +1,7 @@
1
1
  {% capture footer_custom %}
2
2
  {%- include footer_custom.html -%}
3
3
  {% endcapture %}
4
- {% if footer_custom != "" or site.last_edit_timestamp or site.gh_edit_link %}
4
+ {% if footer_custom != "" or site.last_edit_timestamp or site.gh_edit_link or site.back_to_top %}
5
5
  <hr>
6
6
  <footer>
7
7
  {% if site.back_to_top %}
@@ -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 %}