Skip to content

Commit b62c695

Browse files
authored
Merge pull request cockroachdb#3434 from cockroachdb/highlight_sidebar_without_explicit_dot-html
Highlight sidebar links for URLs without explicitly-appended `.html`
2 parents 0b6ac43 + 5996341 commit b62c695

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

_includes/sidebar.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@
135135
}
136136
return url;
137137
});
138+
139+
// this ensures page will be highlighted in sidebar even if URL is accessed without `.html` appended
140+
var activePathname = location.pathname.slice(-5) === '.html' ? location.pathname : location.pathname + '.html';
138141

139-
var active = (urls.indexOf(location.pathname) !== -1);
142+
var active = (urls.indexOf(activePathname) !== -1);
140143
if (active) {
141144
// This mutation inside an otherwise pure function is
142145
// unfortunate, but doing it here avoids a separate

0 commit comments

Comments
 (0)