highlight doc link when active
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/97090bcf Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/97090bcf Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/97090bcf Branch: refs/heads/develop Commit: 97090bcfb68d9ee33d6fdc1b00a85ae0c17528f6 Parents: 191958a Author: Gavin Jefferies <[email protected]> Authored: Fri May 20 12:58:58 2016 -0700 Committer: Gavin Jefferies <[email protected]> Committed: Fri May 20 12:58:58 2016 -0700 ---------------------------------------------------------------------- custom-theme/nav.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/97090bcf/custom-theme/nav.html ---------------------------------------------------------------------- diff --git a/custom-theme/nav.html b/custom-theme/nav.html index 17df657..d063068 100644 --- a/custom-theme/nav.html +++ b/custom-theme/nav.html @@ -1,7 +1,14 @@ + +{% set not_doc_page_titles = ['Home', 'Quick Start', 'About', 'Download', 'Community', 'Events'] %} + {% macro active_nav(page, title, classes) %} class="{% if page and page.title == title %}active {% endif %}{{ classes }}" {% endmacro %} +{% macro docs_are_active(page) %} + class="{% if not page or not page.title in not_doc_page_titles %}active{% endif %}" +{% endmacro %} + <nav id="navbar" class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <!-- Collapsed navigation --> @@ -29,7 +36,7 @@ <li {{ active_nav(current_page, 'About') }}> <a href="/about/">About</a> </li> - <li> + <li {{ docs_are_active(current_page) }}> <a href="/os/introduction/">Documentation</a> </li> <li {{ active_nav(current_page, 'Download') }}>
