|
8 | 8 | {% endcomment %} |
9 | 9 |
|
10 | 10 | <nav class="collapse bd-links" id="bd-docs-nav"> |
11 | | - {%- assign page_url = page.url | split: '/' -%} |
12 | | - |
13 | | - {% if page_url.size == 5 %} |
14 | | - {%- assign page_slug_index = page_url.size | minus: 2 -%} |
15 | | - {%- assign page_slug = page_url[page_slug_index] -%} |
16 | | - {%- assign sub_page_slug = page_url | last -%} |
17 | | - {% else %} |
18 | | - {%- assign page_slug = page_url | last -%} |
19 | | - {% endif %} |
20 | | - |
21 | | - {% comment %} |
22 | | - <!-- |
23 | | - page_slug_index: {{ page_slug_index }} |
24 | | - page_slug: {{ page_slug }} |
25 | | - sub_page_slug: {{ sub_page_slug }} |
26 | | - --> |
27 | | - {% endcomment %} |
| 11 | + {%- assign current_page_url = site.baseurl | append: page.url -%} |
28 | 12 |
|
29 | 13 | <ul id="bd-docs-nav-list" class="list-unstyled"> |
30 | 14 | {%- for navItem in site.data.nav -%} |
|
43 | 27 | {%- assign link_slug = link.title | slugify -%} |
44 | 28 | {% endif %} |
45 | 29 |
|
46 | | - {%- assign active = nil -%} |
| 30 | + {% assign group_url = site.baseurl | append: '/docs/' | append: group_slug | append: '/' %} |
47 | 31 |
|
48 | | - {% comment %} |
49 | | - <!-- |
50 | | - page.group: {{ page.group }} |
51 | | - group_slug: {{ group_slug }} |
52 | | - --> |
53 | | - {% endcomment %} |
| 32 | + {%- assign active = nil -%} |
54 | 33 |
|
55 | | - {%- if page.group == group_slug -%} |
| 34 | + {%- if current_page_url contains group_url -%} |
56 | 35 | {%- assign active = 'active' -%} |
57 | 36 | {%- endif -%} |
58 | 37 |
|
59 | 38 | <li class="bd-toc-item bd-nav-links-item {% unless active == nil %} {{ active }}{% endunless %}{% unless navItem.pages.size != 0%} has-children {% endunless %}"> |
60 | 39 | <!-- first lvl - group --> |
61 | 40 | <a class="h6 bd-nav-links-item-group bd-toc-link font-weight-bold" |
62 | 41 | data-size="{{ navItem.pages.size }}" |
63 | | - data-href="{{ site.baseurl }}/docs/{{ group_slug }}/{{ link_slug }}{% if link_slug %}/{% endif %}"> |
| 42 | + data-href="{{ group_url }}{% if link_slug %}{{ link_slug }}/{% endif %}"> |
64 | 43 | {{ navItem.title }} |
65 | 44 | </a> |
66 | | - <!-- 2nd lvl menu --> |
| 45 | + |
| 46 | + <!-- 2nd lvl menu - doc --> |
67 | 47 | <ul class="nav bd-sidenav"> |
68 | 48 | {%- for doc in navItem.pages -%} |
69 | 49 |
|
|
79 | 59 | {%- assign doc_slug = doc.title | slugify -%} |
80 | 60 | {% endif %} |
81 | 61 |
|
| 62 | + {% assign doc_url = group_url | append: doc_slug | append: '/' %} |
| 63 | + |
82 | 64 | {%- assign active = nil -%} |
83 | 65 |
|
84 | | - {%- if page.group == group_slug and page_slug == doc_slug -%} |
| 66 | + {%- if current_page_url contains doc_url -%} |
85 | 67 | {%- assign active = 'bd-sidenav-active active' -%} |
86 | 68 | {%- endif -%} |
87 | | - <!-- 2nd lvl menu item --> |
| 69 | + |
| 70 | + <!-- 2nd lvl menu item - doc --> |
88 | 71 | <li class="{% unless active == nil %} {{ active }} {% endunless %} {% if doc.sub-pages.size > 0%} has-children {% endif %} {% if doc_disabled == true %}disabled{% endif %} "> |
89 | | - <a href="{{ site.baseurl }}/docs/{{ group_slug }}/{{ doc_slug }}/" |
| 72 | + <a href="{{ doc_url }}" |
90 | 73 | data-size="{{ doc.sub-pages.size }}" |
91 | 74 | data-doc-slug="{{ doc_slug }}" |
92 | 75 | {% if doc_disabled == true %} class="disabled"{% endif %} |
|
95 | 78 | </a> |
96 | 79 |
|
97 | 80 | {% unless doc.sub-pages == nil %} |
98 | | - <!--3rd lvl menu --> |
| 81 | + <!-- 3rd lvl menu - sub_doc --> |
99 | 82 | <ul class="nav bd-sidenav"> |
100 | | - {%- for subdoc in doc.sub-pages -%} |
| 83 | + {%- for sub_doc in doc.sub-pages -%} |
101 | 84 |
|
102 | | - {% if subdoc.url contains '/docs/'%} |
| 85 | + {% if sub_doc.url contains '/docs/'%} |
103 | 86 | {% assign subdoc_disabled = true %} |
104 | 87 | {% else %} |
105 | 88 | {% assign subdoc_disabled = false %} |
106 | 89 | {% endif %} |
107 | 90 |
|
108 | | - {% if subdoc.url %} |
109 | | - {%- assign sub_doc_slug = subdoc.url | slugify -%} |
| 91 | + {% if sub_doc.url %} |
| 92 | + {%- assign sub_doc_slug = sub_doc.url | slugify -%} |
110 | 93 | {% else %} |
111 | | - {%- assign sub_doc_slug = subdoc.title | slugify -%} |
| 94 | + {%- assign sub_doc_slug = sub_doc.title | slugify -%} |
112 | 95 | {% endif %} |
113 | 96 |
|
| 97 | + {%- assign sub_doc_url = doc_url | append: sub_doc_slug | append: '/' -%} |
| 98 | + |
114 | 99 | {%- assign sub_active = nil -%} |
115 | 100 |
|
116 | | - {% comment %} |
117 | | - <!-- |
118 | | - page.sub_group: {{ page.sub_group }} |
119 | | - group_slug: {{ group_slug }} |
120 | | - doc_slug: {{ doc_slug }} |
121 | | - sub_page_slug: {{ sub_page_slug }} |
122 | | - sub_doc_slug: {{ sub_doc_slug }} |
123 | | - --> |
124 | | - {% endcomment %} |
125 | | - |
126 | | - {%- if page.sub_group == doc_slug and sub_page_slug == sub_doc_slug -%} |
| 101 | + {%- if current_page_url contains sub_doc_url -%} |
127 | 102 | {%- assign sub_active = 'active bd-sidenav-active' -%} |
128 | 103 | {%- endif -%} |
129 | 104 |
|
130 | | - <li class="bd-sidenav-item{% unless sub_active == nil %} {{ sub_active }}{% endunless %}{% if subdoc_disabled == true %} disabled{% endif %} "> |
131 | | - <a href="{{ site.baseurl }}/docs/{{ group_slug }}/{{ doc_slug }}/{{ sub_doc_slug }}/" |
| 105 | + <!-- 3rd lvl menu item - sub_doc --> |
| 106 | + <li class="bd-sidenav-item {% unless sub_active == nil %}{{ sub_active }}{% endunless %} {% if subdoc_disabled == true %}disabled{% endif %} {% if sub_doc.sub-pages.size > 0%}has-children{% endif %}"> |
| 107 | + <a href="{{ sub_doc_url }}" |
132 | 108 | {% if subdoc_disabled == true %} class="disabled"{% endif %} |
133 | 109 | > |
134 | | - {{ subdoc.title }} |
| 110 | + {{ sub_doc.title }} |
135 | 111 | </a> |
| 112 | + |
| 113 | + <!-- 4rd lvl menu - sub_doc_lvl2 --> |
| 114 | + {% unless sub_doc.sub-pages == nil %} |
| 115 | + <ul class="nav bd-sidenav"> |
| 116 | + {%- for sub_doc_lvl2 in sub_doc.sub-pages -%} |
| 117 | + |
| 118 | + {% if sub_doc_lvl2.url %} |
| 119 | + {%- assign sub_doc_lvl2_slug = sub_doc_lvl2.url | slugify -%} |
| 120 | + {% else %} |
| 121 | + {%- assign sub_doc_lvl2_slug = sub_doc_lvl2.title | slugify -%} |
| 122 | + {% endif %} |
| 123 | + |
| 124 | + {%- assign sub_doc_lvl2_active = nil -%} |
| 125 | + |
| 126 | + {%- assign sub_doc_lvl2_url = sub_doc_url | append: sub_doc_lvl2_slug | append: '/' -%} |
| 127 | + |
| 128 | + {%- if current_page_url contains sub_doc_lvl2_url -%} |
| 129 | + {%- assign sub_doc_lvl2_active = 'active bd-sidenav-active' -%} |
| 130 | + {%- endif -%} |
| 131 | + |
| 132 | + <!-- 4rd lvl menu item - sub_doc_lvl2 --> |
| 133 | + <li class="bd-sidenav-item {% unless sub_doc_lvl2_active == nil %}{{ sub_doc_lvl2_active }}{% endunless %} {% if sub_doc_lvl2.sub-pages.size > 0%}has-children{% endif %}"> |
| 134 | + <a href="{{ sub_doc_lvl2_url }}"> |
| 135 | + {{ sub_doc_lvl2.title }} |
| 136 | + </a> |
| 137 | + |
| 138 | + <!-- 5rd lvl menu - subdoc_lvl3 --> |
| 139 | + {% unless sub_doc_lvl2.sub-pages == nil %} |
| 140 | + <ul class="nav bd-sidenav"> |
| 141 | + {%- for sub_doc_lvl3 in sub_doc_lvl2.sub-pages -%} |
| 142 | + |
| 143 | + {% if sub_doc_lvl3.url %} |
| 144 | + {%- assign sub_doc_lvl3_slug = sub_doc_lvl3.url | slugify -%} |
| 145 | + {% else %} |
| 146 | + {%- assign sub_doc_lvl3_slug = sub_doc_lvl3.title | slugify -%} |
| 147 | + {% endif %} |
| 148 | + |
| 149 | + {%- assign sub_doc_lvl3_active = nil -%} |
| 150 | + |
| 151 | + {%- assign sub_doc_lvl3_url = sub_doc_lvl2_url | append: sub_doc_lvl3_slug | append: '/' -%} |
| 152 | + |
| 153 | + {%- if current_page_url contains sub_doc_lvl3_url -%} |
| 154 | + {%- assign sub_doc_lvl3_active = 'active bd-sidenav-active' -%} |
| 155 | + {%- endif -%} |
| 156 | + |
| 157 | + <!-- 5rd lvl menu item - subdoc_lvl3 --> |
| 158 | + <li class="bd-sidenav-item {% unless sub_doc_lvl3_active == nil %}{{ sub_doc_lvl3_active }}{% endunless %}"> |
| 159 | + <a href="{{ sub_doc_lvl3_url }}"> |
| 160 | + {{ sub_doc_lvl3.title }} |
| 161 | + </a> |
| 162 | + </li> |
| 163 | + {%- endfor -%} |
| 164 | + </ul> |
| 165 | + {% endunless %} |
| 166 | + </li> |
| 167 | + {%- endfor -%} |
| 168 | + </ul> |
| 169 | + {% endunless %} |
136 | 170 | </li> |
137 | 171 |
|
138 | 172 | {%- endfor -%} |
139 | 173 | </ul> |
140 | | - <!--/3rd lvl menu--> |
141 | 174 | {% endunless %} |
142 | 175 |
|
143 | 176 | {%- comment -%} |
|
0 commit comments