Skip to content

Commit

Permalink
Fix navbar's active class.
Browse files Browse the repository at this point in the history
Use a new variable based on `req.originalUrl`.
  • Loading branch information
XhmikosR committed May 26, 2018
1 parent 90cf9f4 commit beb59b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions routes/appendLocals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function appendLocals(req, res) {
res.locals.canonicalUrl = `${req.config.siteurl}${req.path}`;

res.locals.siteUrl = `${proto}://${req.hostname}`;
res.locals.pageUrl = req.originalUrl;

res.locals.theme = req.query.theme < totalThemes ?
req.query.theme :
Expand Down
2 changes: 1 addition & 1 deletion views/_mixins.pug
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mixin menuItem(name, url)
classes.push(attributes['extra-class']);
}
if (title === name) {
if (pageUrl === url) {
classes.push('active');
}
Expand Down

0 comments on commit beb59b8

Please sign in to comment.