Skip to content

Commit 58cc92f

Browse files
keanuleejustinfagnani
authored andcommitted
Highlight active link in side nav (#504)
1 parent 0093b43 commit 58cc92f

File tree

7 files changed

+12
-4
lines changed

7 files changed

+12
-4
lines changed

docs/_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ collections:
1111
output: true
1212
guide:
1313
output: true
14+
permalink: /:collection/:title
1415
try:
1516
output: true
17+
permalink: /:collection/:title
1618
include:
1719
- "_*_.html"
1820
- "_*_.*.html"

docs/_guide/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
layout: guide
33
title: Introduction
4+
permalink: /guide
45
---
56

67
{::options toc_levels="1..3" /}

docs/_includes/topnav.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<nav class="main-nav" markdown="0">
22
<a class="nav-title" href="{{ site.baseurl }}/">{{ site.name }}</a>
33
<div class="flex"></div>
4-
<a class="nav-item" href="{{ site.baseurl }}/try/">Try</a>
5-
<a class="nav-item" href="{{ site.baseurl }}/guide/">Guide</a>
4+
<a class="nav-item" href="{{ site.baseurl }}/try">Try</a>
5+
<a class="nav-item" href="{{ site.baseurl }}/guide">Guide</a>
66
<a class="nav-item" href="{{ site.baseurl }}/api/index.html">API</a>
77
<a class="icon" href="https://github.com/polymer/lit-element" title="GitHub">
88
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentcolor">

docs/_layouts/guide.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<button id="toggleNavButton">Menu</button>
1010
<ul>
1111
{%- for item in site.data.guide.toc -%}
12-
<li>
12+
<li class="{% if page.url == item[1].url %}active{% endif %}">
1313
<a href="{{site.baseurl}}{{item[1].url}}">{{item[1].title}}</a>
1414
</li>
1515
{%- endfor -%}

docs/_layouts/try.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<button id="toggleNavButton">Menu</button>
1010
<ul>
1111
{%- for item in site.data.try.toc -%}
12-
<li>
12+
<li class="{% if page.url == item[1].url %}active{% endif %}">
1313
<a href="{{site.baseurl}}{{item[1].url}}">{{item[1].title}}</a>
1414
</li>
1515
{%- endfor -%}

docs/_try/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
layout: try
33
title: Try LitElement
4+
permalink: /try
45
---
56

67
Try LitElement in live-editable code without installing anything. Build your first component, use it in a web page, and add style with CSS.

docs/css/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ section p {
367367
line-height: 22px;
368368
}
369369

370+
.side-nav li:not(.active) a {
371+
color: #222;
372+
}
373+
370374
/* Article area */
371375
article {
372376
flex: 1;

0 commit comments

Comments
 (0)