11{% set menu_2nd_level_selected = [] %}
2+ {% set menu_group_titles = [''] %}
23<!DOCTYPE html>
34< html lang ="{{ config.extra.lang|default('en') }} ">
45 < head >
7879 < link rel ="stylesheet " href ="/css/code.css ">
7980 < link rel ="stylesheet " href ="/css/footer.css ">
8081 < link rel ="stylesheet " href ="/css/utilities.css ">
82+ < link rel ="stylesheet " href ="/css/blog.css ">
8183
8284 < script async src ="https://www.googletagmanager.com/gtag/js?id=UA-213158050-1 "> </ script >
8385 < script >
8890
8991 < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/js/bootstrap.bundle.min.js "
9092 integrity ="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz " crossorigin ="anonymous " defer > </ script >
91- < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/masonry.pkgd.min.js "
92- integrity ="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D " crossorigin ="anonymous " async > </ script >
9393
9494 {% block header_extra %}
9595 {% endblock header_extra%}
125125
126126 {% if nav|length > 0 %}
127127 {% for nav_item in nav %}
128-
129128 {% if not nav_item.children %}
130129 <!-- Top-level single page -->
131130 < li class ="nav-item {% if nav_item.active %}nav_active{% endif %} ">
137136 </ li >
138137
139138 {% else %}
140- <!-- Top-level section with children => MEGA DROPDOWN -->
139+ {# capture this top-level index (avoid loop.parent) #}
140+ {% set top_i = loop.index0 %}
141+
142+ <!-- Top-level section with children => MEGA DROPDOWN + Bootstrap accordion -->
141143 < li class ="nav-item dropdown {% if nav_item.active %}nav_active{% endif %} ">
142144 < a class ="nav-link dropdown-toggle {% if nav_item.active %}active{% endif %} "
143145 href ="# " role ="button " data-bs-toggle ="dropdown " data-bs-auto-close ="outside "
144146 aria-expanded ="false ">
145147 {{ nav_item.title }}
146148 </ a >
147149
148- < div class ="dropdown-menu mega " role ="menu " aria-label ="{{ nav_item.title }} ">
149- {# Parent Overview (works with 'index' or 'Overview') #}
150- {% set parent_index_url = None %}
150+ < div class ="dropdown-menu mega p-2 " role ="menu " aria-label ="{{ nav_item.title }} ">
151+ {# optional Overview link for the section #}
152+ {% set parent_overview = None %}
151153 {% for ch in nav_item.children %}
152- {% if ch.title in ['index','Overview'] %}
153- {% set parent_index_url = ch.url|url %}
154+ {% if ch.title in menu_group_titles %}
155+ {% set parent_overview = ch %}
154156 {% endif %}
155157 {% endfor %}
156- {% if parent_index_url %}
157- < div class ="mega-head px-2 py -2 ">
158- < a class ="dropdown-item fw-semibold " href ="{{ parent_index_url }} ">
158+ {% if parent_overview %}
159+ < div class ="px-2 pb -2 ">
160+ < a class ="dropdown-item fw-semibold " href ="{{ parent_overview.url|url }} ">
159161 {{ nav_item.title }} · Overview
160162 </ a >
161163 </ div >
162- < hr class ="dropdown-divider my-1 ">
164+ < hr class ="dropdown-divider my-2 ">
163165 {% endif %}
164166
165- < div class ="mega-grid ">
167+ {# Accordion: one open at a time #}
168+ < div class ="accordion " id ="mega-acc-{{ top_i }} ">
166169 {% for child in nav_item.children %}
167- {% if child.title not in ['index','Overview'] %}
170+ {% if child.title not in menu_group_titles %}
168171
169172 {% if child.children %}
170- {# CHILD SECTION COLUMN (with its own Overview + grandchildren) #}
171- {% set child_index_url = None %}
172- {% for gc in child.children %}
173- {% if gc.title in ['index','Overview'] %}
174- {% set child_index_url = gc.url|url %}
175- {% endif %}
176- {% endfor %}
177-
178- < section class ="mega-group ">
179- < a class ="group-title " href ="{{ child_index_url or '#' }} "> {{ child.title }}</ a >
180- < ul class ="list-unstyled mb-0 ">
181- {% for gc in child.children %}
182- {% if gc.title not in ['index','Overview'] %}
183- < li >
184- < a class ="dropdown-item small py-1 {% if gc.active %}active{% endif %} "
185- href ="{{ gc.url|url }} "> {{ gc.title }}</ a >
186- </ li >
187- {% endif %}
188- {% endfor %}
189- </ ul >
190- </ section >
173+ {# child is a subgroup with grandchildren -> accordion item #}
174+ {% set hdr_id = 'mh-' ~ top_i ~ '-' ~ loop.index0 %}
175+ {% set col_id = 'mc-' ~ top_i ~ '-' ~ loop.index0 %}
176+ < div class ="accordion-item mega-group ">
177+ < h2 class ="accordion-header " id ="{{ hdr_id }} ">
178+ < button class ="accordion-button collapsed group-title " type ="button "
179+ data-bs-toggle ="collapse "
180+ data-bs-target ="#{{ col_id }} "
181+ aria-controls ="{{ col_id }} "
182+ aria-expanded ="false ">
183+ {{ child.title }}
184+ </ button >
185+ </ h2 >
186+ < div id ="{{ col_id }} " class ="accordion-collapse collapse "
187+ data-bs-parent ="#mega-acc-{{ top_i }} ">
188+ < div class ="accordion-body p-2 ">
189+ {% set child_overview = None %}
190+ {% for gc in child.children %}
191+ {% if gc.title in menu_group_titles %}
192+ {% set child_overview = gc %}
193+ {% endif %}
194+ {% endfor %}
195+
196+ < ul class ="list-unstyled mb-0 ">
197+ {% if child_overview %}
198+ < li >
199+ < a class ="dropdown-item small py-1 {% if child_overview.active %}active{% endif %} "
200+ href ="{{ child_overview.url|url }} "> Overview</ a >
201+ </ li >
202+ {% endif %}
203+ {% for gc in child.children %}
204+ {% if gc.title not in menu_group_titles %}
205+ < li >
206+ < a class ="dropdown-item small py-1 {% if gc.active %}active{% endif %} "
207+ href ="{{ gc.url|url }} "> {{ gc.title }}</ a >
208+ </ li >
209+ {% endif %}
210+ {% endfor %}
211+ </ ul >
212+ </ div >
213+ </ div >
214+ </ div >
191215
192216 {% else %}
193- {# CHILD PLAIN PAGE as a single link column #}
194- < section class ="mega-group ">
217+ {# child is just a page - > simple link in the mega menu #}
218+ < div class ="px-1 ">
195219 < a class ="dropdown-item {% if child.active %}active{% endif %} "
196220 href ="{{ child.url|url }} "> {{ child.title }}</ a >
197- </ section >
221+ </ div >
198222 {% endif %}
199223
200224 {% endif %}
203227 </ div >
204228 </ li >
205229 {% endif %}
206-
207230 {% endfor %}
208231 {% endif %}
209232
212235 </ div >
213236 </ nav >
214237
238+
215239 <!-- ========================= MOBILE OFFCANVAS (Accordion) ========================= -->
216240 < div class ="offcanvas offcanvas-end text-bg-dark " tabindex ="-1 " id ="offcanvasNav " aria-labelledby ="offcanvasNavLabel ">
217241 < div class ="offcanvas-header ">
@@ -254,22 +278,22 @@ <h2 class="accordion-header" id="h-{{ pid }}">
254278
255279 {# Parent Overview #}
256280 {% for ch in nav_item.children %}
257- {% if ch.title in ['index','Overview'] %}
281+ {% if ch.title in menu_group_titles %}
258282 < a class ="nav-link py-1 {% if ch.active %}active{% endif %} " href ="{{ ch.url|url }} "> Overview</ a >
259283 {% endif %}
260284 {% endfor %}
261285
262286 {# Children #}
263287 {% for child in nav_item.children %}
264- {% if child.title not in ['index','Overview'] %}
288+ {% if child.title not in menu_group_titles %}
265289
266290 {% if child.children %}
267291 {# Section subtree #}
268292 < div class ="mt-2 small text-secondary "> {{ child.title }}</ div >
269293 < ul class ="list-unstyled ms-2 ">
270294 {% set child_index = None %}
271295 {% for gc in child.children %}
272- {% if gc.title in ['index','Overview'] %}{% set child_index = gc %}{% endif %}
296+ {% if gc.title in menu_group_titles %}{% set child_index = gc %}{% endif %}
273297 {% endfor %}
274298 {% if child_index %}
275299 < li >
@@ -278,7 +302,7 @@ <h2 class="accordion-header" id="h-{{ pid }}">
278302 </ li >
279303 {% endif %}
280304 {% for gc in child.children %}
281- {% if gc.title not in ['index','Overview'] %}
305+ {% if gc.title not in menu_group_titles %}
282306 < li >
283307 < a class ="nav-link py-1 {% if gc.active %}active{% endif %} "
284308 href ="{{ gc.url|url }} "> {{ gc.title }}</ a >
@@ -416,7 +440,7 @@ <h2 class="accordion-header" id="h-{{ pid }}">
416440 < div class ="container-xxl ">
417441 < div class ="footer_inner ">
418442 < div class ="d-flex align-items-center gap-3 ">
419- < img src ="/icons/osl-logo-black.svg " class ="icon icon_2 transparent " alt ="Open Science Labs " style ="height:28px; ">
443+ < img src ="/icons/osl-logo-black.svg " class ="transparent " alt ="Open Science Labs " style ="height:28px; ">
420444 < div class ="d-flex align-items-center gap-3 ">
421445 < a href ="https://github.com/OpenScienceLabs " target ="_blank " aria-label ="GitHub ">
422446 < svg class ="icon "> < use xlink:href ="#github "/> </ svg >
0 commit comments