Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Accommodate /DIR/DIR menu pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Aug 7, 2024
1 parent 7098913 commit b1afbef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion layouts/DocsPage/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "./types";
import styles from "./Navigation.module.css";
import { useVersionAgnosticPages } from "utils/useVersionAgnosticPages";
import { dirname } from "path";

const SCOPELESS_HREF_REGEX = /\?|\#/;

Expand Down Expand Up @@ -48,7 +49,12 @@ const DocsNavigationItems = ({
const selected = entry.slug === docPath;
const active =
selected ||
entry.entries?.some((entry) => docPath.startsWith(entry.slug));
entry.entries?.some((entry) => {
return (
docPath.startsWith(entry.slug) ||
docPath.startsWith(dirname(entry.slug))
);
});

return (
<li key={entry.slug}>
Expand Down

0 comments on commit b1afbef

Please sign in to comment.