Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineConfig({
{ text: 'Open Source', link: '/opensource' },
{ text: 'Links', link: '/links' },
{ text: 'Interviews', link: '/interviews/' },
{ text: 'Wiki', link: 'https://mume.org/wiki/' }
{ text: 'Wiki', link: 'https://docs.mume.org/wiki/' }
]
}
]
Expand Down
26 changes: 21 additions & 5 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ import './mume.css'
const { site, page, frontmatter } = useData()
const vpRoute = useRoute()

const isActive = (path, exact = false) => {
const target = withBase(path)
const current = vpRoute.path

if (exact) {
return current === target || (target === '/' && (current === '/' || current === '/index.html'))
}

if (target === '/') return current === '/' || current === '/index.html'

const normalizedTarget = target.endsWith('/') ? target : target + '/'
const normalizedCurrent = current.endsWith('/') ? current : current + '/'

return normalizedCurrent.startsWith(normalizedTarget)
}

const isMenuOpen = ref(false)
const navbarRef = ref(null)
const gandalfRef = ref(null)
Expand Down Expand Up @@ -70,14 +86,14 @@ onUnmounted(() => {
<a href="https://mume.org/play/">Play<img alt="Play" height="16" width="16" style="padding-left:4px; vertical-align:-10%;" :src="withBase('/favicon.ico')"></a>
</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.

<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>
<li><a href="https://elvenrunes.com" target="_blank" rel="noopener">Elvenrunes <i class="fa fa-external-link" aria-hidden="true"></i></a></li>
<li><a :href="withBase('/opensource')" :class="{ current: vpRoute.path.startsWith(withBase('/opensource')) }">Open Source</a></li>
<li><a :href="withBase('/links')" :class="{ current: vpRoute.path.startsWith(withBase('/links')) }">Links</a></li>
<li><a :href="withBase('/interviews')" :class="{ current: vpRoute.path.startsWith(withBase('/interviews')) }">Interviews</a></li>
<li><a href="https://mume.org/wiki/">Wiki</a></li>
<li><a :href="withBase('/opensource')" :class="{ current: isActive('/opensource') }">Open Source</a></li>
<li><a :href="withBase('/links')" :class="{ current: isActive('/links') }">Links</a></li>
<li><a :href="withBase('/interviews')" :class="{ current: isActive('/interviews') }">Interviews</a></li>
<li><a href="https://docs.mume.org/wiki/" target="_self" rel="external">Wiki</a></li>
</ul>
</li>
<li class="has_children">
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ You can trust us to stick to you through thick and thin&mdash;to the bitter end.
<p>
The official Wiki contains tips, hints, and all sorts of useful information for newcomers and veterans alike.
</p>
<a href="https://mume.org/wiki/" class="read-more">Visit the Wiki <i class="fa fa-external-link" aria-hidden="true"></i></a>
<a href="https://docs.mume.org/wiki/" target="_self" rel="external" class="read-more">Visit the Wiki <i class="fa fa-external-link" aria-hidden="true"></i></a>
</div>
</div>
</section>
Expand Down
Loading