Skip to content

Commit bffa7f0

Browse files
fix: dynamically highlight active navigation tab based on current page. Closes Issue #154
1 parent 3870d4f commit bffa7f0

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

_includes/header.html

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,21 @@ <h2 id="project_tagline">{{ page.subtitle }}</h2>
1313
</div>
1414
<!-- Tabbed navigation bar -->
1515
<ul class="nav nav-tabs">
16-
<li id="home" class="active" role="presentation"><a href="/">Home</a></li>
17-
<li id="news" role="presentation"><a href="/news">News</a></li>
18-
<li id="blog" role="presentation"><a href="/blog">Blog</a></li>
19-
<li id="GSoC" role="presentation"><a href="/GSoC">GSoC</a></li>
20-
<li id="tutorials" role="presentation"><a href="/tutorials">Tutorials</a></li>
16+
<li id="home" class="{% if page.url == '/' %}active{% endif %}" role="presentation">
17+
<a href="/">Home</a>
18+
</li>
19+
<li id="news" class="{% if page.url contains '/news' %}active{% endif %}" role="presentation">
20+
<a href="/news">News</a>
21+
</li>
22+
<li id="blog" class="{% if page.url contains '/blog' %}active{% endif %}" role="presentation">
23+
<a href="/blog">Blog</a>
24+
</li>
25+
<li id="GSoC" class="{% if page.url contains '/GSoC' %}active{% endif %}" role="presentation">
26+
<a href="/GSoC">GSoC</a>
27+
</li>
28+
<li id="tutorials" class="{% if page.url contains '/tutorials' %}active{% endif %}" role="presentation">
29+
<a href="/tutorials">Tutorials</a>
30+
</li>
2131
</ul>
2232
<!-- INCLUDE DOWNLOAD BUTTON IF THE PAGE HAS IT SET IN THE FRONT-MATTER -->
2333
{% if page.download == true %}

0 commit comments

Comments
 (0)