diff --git a/templates/macros.html b/templates/macros.html index e597160..b40ece2 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,6 +1,14 @@ {% macro nav_link(path, label) %} {% set href = get_url(path=path) %} -{% set active = current_url | default(value='') == href %} +{% set base_url = get_url(path='/') ~ '/' %} +{% set curr_default = current_url | default(value='') %} +{% if curr_default == '' or curr_default == '/' or href == base_url %} + {% set active = curr_default == href %} +{% elif curr_default is starting_with(href) %} + {% set active = true %} +{% else %} + {% set active = false %} +{% endif %} {# Desktop version #} @@ -75,4 +83,4 @@ } }); -{% endmacro toc_js %} \ No newline at end of file +{% endmacro toc_js %}