diff --git a/examples/active-class-name/components/ActiveLink.js b/examples/active-class-name/components/ActiveLink.js index 2c561338a36a2..0db59b6a9227a 100644 --- a/examples/active-class-name/components/ActiveLink.js +++ b/examples/active-class-name/components/ActiveLink.js @@ -8,8 +8,11 @@ const ActiveLink = ({ children, activeClassName, ...props }) => { const child = Children.only(children) const childClassName = child.props.className || '' + // pages/index.js will be matched via props.href + // pages/about.js will be matched via props.href + // pages/[slug].js will be matched via props.as const className = - asPath === props.href + asPath === props.href || asPath === props.as ? `${childClassName} ${activeClassName}`.trim() : childClassName diff --git a/examples/active-class-name/components/Nav.js b/examples/active-class-name/components/Nav.js index 32e15a23466c2..2c710bb42468f 100644 --- a/examples/active-class-name/components/Nav.js +++ b/examples/active-class-name/components/Nav.js @@ -22,6 +22,11 @@ const Nav = () => ( About +
Hello, I'm the {asPath} page
+ > + ) +} + +export default SlugPage