Navigation selects the current page

This commit is contained in:
Fabrice Mouhartem 2023-11-06 10:00:03 +01:00 committed by Fabrice Mouhartem
parent 9d1a528b74
commit 494379d020
3 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ The content of the website will be in the `public/` folder.
# Todo # Todo
- [ ] Modify templates/nav.html to take into account the current page - [x] Modify templates/nav.html to take into account the current page
- [ ] Select better colors - [ ] Select better colors
- [ ] Multi-language (fr/en) support - [ ] Multi-language (fr/en) support
- https://www.getzola.org/documentation/content/multilingual/ - https://www.getzola.org/documentation/content/multilingual/

View File

@ -119,7 +119,7 @@ nav {
background-color: $menu_btn-selected; background-color: $menu_btn-selected;
text-decoration: none; text-decoration: none;
} }
a.nav_selected { a.nav_current {
background-color: $menu_btn-selected; background-color: $menu_btn-selected;
} }
font-size: 14pt; font-size: 14pt;

View File

@ -1,9 +1,9 @@
<nav> <nav>
<menu> <menu>
<li><a class="nav_selected" href="/">Home</a></li> <li><a {% if section and section == root %} class="nav_current" {% endif %} href="/">Home</a></li>
{% for subsection in root.subsections %} {% for subsection in root.subsections %}
{% set subsection = get_section(path=subsection, metadata_only=true) %} {% set subsection = get_section(path=subsection, metadata_only=true) %}
<li><a href="{{ subsection.permalink }}">{{ subsection.title }}</a></li> <li><a href="{{ subsection.permalink }}" {% if section and section == subsection %} class="nav_current" {% endif %}>{{ subsection.title }}</a></li>
{% endfor %} {% endfor %}
</menu> </menu>
</nav> </nav>