Skip to content

Fix nav highlighting and wiki link#11

Closed
nschimme wants to merge 2 commits intoMUME:masterfrom
nschimme:fix-nav-highlighting-and-wiki-link-2493545194803403115
Closed

Fix nav highlighting and wiki link#11
nschimme wants to merge 2 commits intoMUME:masterfrom
nschimme:fix-nav-highlighting-and-wiki-link-2493545194803403115

Conversation

@nschimme
Copy link
Copy Markdown
Contributor

@nschimme nschimme commented May 5, 2026

Summary by Sourcery

Improve docs navigation highlighting and update wiki links to the new docs host.

Bug Fixes:

  • Fix navbar active state detection for community and subpage links using a shared route helper.

Enhancements:

  • Refine nav active route matching logic to better handle root and subdirectory paths.

Documentation:

nschimme added 2 commits May 2, 2026 22:06
- Refactored `isActive` logic in `Layout.vue` to ensure the "Community" navbar item is only highlighted (gold) on the home page.
- Ensured "Open Source", "Links", and "Interviews" sections correctly highlight their parent navigation items when their respective pages or sub-pages are active.
- Updated all MUME Wiki links to use the absolute path `https://docs.mume.org/wiki/`.
- Restricted 'Community' nav highlight to the home page only.
- Ensured 'Open Source', 'Links', and 'Interviews' parents highlight when active.
- Updated Wiki link to absolute path 'https://docs.mume.org/wiki/'.
- Added 'target="_self"' and 'rel="external"' to Wiki links to ensure they open in the same tab and prevent VitePress router interference.
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 5, 2026

Reviewer's Guide

Refactors the navigation highlighting logic in the custom VitePress layout into a reusable helper and updates all Wiki links to point to docs.mume.org with consistent link attributes.

Sequence diagram for updated nav highlighting on route change

sequenceDiagram
  actor User
  participant Browser
  participant VitePressRouter
  participant LayoutComponent
  participant isActiveHelper

  User->>Browser: Click nav link (e.g. /opensource)
  Browser->>VitePressRouter: Navigate to new path
  VitePressRouter-->>Browser: Update current route path
  Browser->>LayoutComponent: Re-render Layout.vue
  LayoutComponent->>isActiveHelper: isActive('/', true)
  isActiveHelper-->>LayoutComponent: true or false (Community highlighted)
  LayoutComponent->>isActiveHelper: isActive('/opensource')
  isActiveHelper-->>LayoutComponent: true for /opensource path and children
  LayoutComponent-->>Browser: Render nav with current class on matching items
  Browser-->>User: Display updated highlighted navigation
Loading

File-Level Changes

Change Details Files
Introduce a reusable route-activation helper for navbar highlighting and apply it to Community submenu links.
  • Add an isActive(path, exact) utility using withBase and vpRoute.path to handle exact and prefix route matching, including special handling for root paths and trailing slashes.
  • Replace inline vpRoute.path comparison logic on the Community parent link with isActive('/', true).
  • Update Community submenu items (Open Source, Links, Interviews) to use isActive() for their current-state class bindings instead of duplicating path prefix checks.
docs/.vitepress/theme/Layout.vue
Standardize Wiki links to the new docs.mume.org domain and adjust link attributes for consistent behavior. docs/.vitepress/config.js
docs/.vitepress/theme/Layout.vue
docs/index.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new isActive('/', true) on the Community top-level link no longer marks Community as active when viewing /opensource, /links, or /interviews, which changes behavior from the previous implementation and may be an unintended UX regression; consider keeping the parent active when a child route is active.
  • Since isActive encapsulates the route matching logic used in several places, you might consider also using it for the Community parent (e.g., isActive('/', /*include children*/) with an option) instead of hardcoding exact = true, to make the API more flexible and self-consistent.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `isActive('/', true)` on the Community top-level link no longer marks Community as active when viewing `/opensource`, `/links`, or `/interviews`, which changes behavior from the previous implementation and may be an unintended UX regression; consider keeping the parent active when a child route is active.
- Since `isActive` encapsulates the route matching logic used in several places, you might consider also using it for the Community parent (e.g., `isActive('/', /*include children*/)` with an option) instead of hardcoding `exact = true`, to make the API more flexible and self-consistent.

## Individual Comments

### Comment 1
<location path="docs/.vitepress/theme/Layout.vue" line_range="89" />
<code_context>
         </li>
         <li class="has_children">
-          <a :href="withBase('/')" :class="{ current: vpRoute.path === '/' || vpRoute.path === '/index.html' || vpRoute.path.startsWith(withBase('/opensource')) || vpRoute.path.startsWith(withBase('/links')) || vpRoute.path.startsWith(withBase('/interviews')) }">Community<span class="caret down"></span></a>
+          <a :href="withBase('/')" :class="{ current: isActive('/', true) }">Community<span class="caret down"></span></a>
           <ul>
             <li><a href="https://discord.gg/XkZN55am9a" target="_blank" rel="noopener">Discord <i class="fa fa-external-link" aria-hidden="true"></i></a></li>
</code_context>
<issue_to_address>
**question (bug_risk):** The `Community` menu no longer stays active when viewing its child pages, which changes prior UX behavior.

Previously, `Community` was marked `current` not only on `/` but also on routes starting with `/opensource`, `/links`, and `/interviews`. With `isActive('/', true)`, it now highlights only on the exact home route.

If that’s not intended, you could either:
- Use `isActive('/', false)` and treat `/` as a parent for those sections, or
- Extend `isActive` (or add a helper) so the parent item is active when any of its child paths are active.

If the change is intentional, just confirm it matches the desired navigation behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

</li>
<li class="has_children">
<a :href="withBase('/')" :class="{ current: vpRoute.path === '/' || vpRoute.path === '/index.html' || vpRoute.path.startsWith(withBase('/opensource')) || vpRoute.path.startsWith(withBase('/links')) || vpRoute.path.startsWith(withBase('/interviews')) }">Community<span class="caret down"></span></a>
<a :href="withBase('/')" :class="{ current: isActive('/', true) }">Community<span class="caret down"></span></a>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): The Community menu no longer stays active when viewing its child pages, which changes prior UX behavior.

Previously, Community was marked current not only on / but also on routes starting with /opensource, /links, and /interviews. With isActive('/', true), it now highlights only on the exact home route.

If that’s not intended, you could either:

  • Use isActive('/', false) and treat / as a parent for those sections, or
  • Extend isActive (or add a helper) so the parent item is active when any of its child paths are active.

If the change is intentional, just confirm it matches the desired navigation behavior.

@nschimme nschimme deleted the fix-nav-highlighting-and-wiki-link-2493545194803403115 branch May 5, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant