mirror of
https://github.com/PR0M3TH3AN/Archivox.git
synced 2025-09-07 14:48:40 +00:00
Merge pull request #26 from PR0M3TH3AN/codex/refactor-sidebar-to-use-details-summary
Refactor sidebar navigation
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
{% macro renderNav(items) %}
|
||||
{% macro renderNav(items, pageUrl) %}
|
||||
<ul>
|
||||
{% for item in items %}
|
||||
<li>
|
||||
<a href="{{ item.path }}">{{ item.page.title }}</a>
|
||||
{% if item.children and item.children.length %}
|
||||
{{ renderNav(item.children) }}
|
||||
{% set sectionPath = item.path | replace('index.html', '') %}
|
||||
<details class="nav-section" {% if pageUrl.startsWith(sectionPath) %}open{% endif %}>
|
||||
<summary>
|
||||
<a href="{{ item.path }}" class="nav-link{% if item.path === pageUrl %} active{% endif %}">
|
||||
{{ item.displayName or item.page.title }}
|
||||
</a>
|
||||
</summary>
|
||||
{{ renderNav(item.children, pageUrl) }}
|
||||
</details>
|
||||
{% else %}
|
||||
<a href="{{ item.path }}" class="nav-link{% if item.path === pageUrl %} active{% endif %}">
|
||||
{{ item.displayName or item.page.title }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
@@ -13,6 +24,6 @@
|
||||
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<nav>
|
||||
{{ renderNav(navigation) }}
|
||||
{{ renderNav(navigation, page.url) }}
|
||||
</nav>
|
||||
</aside>
|
||||
|
Reference in New Issue
Block a user