vitepress
vitepress copied to clipboard
Make Nav URL customisable for home page and subpages
Is your feature request related to a problem? Please describe.
We would like to have a way to easy navigate between home page and subpages.
Describe the solution you'd like
Now, when we press on Nav element it points to the home page. It would be useful to have a way to set a link to that element
- Add
nav-link
to be used when you are on home page - Add
nav-sub-link
to be used when you are on subpage, and if not defined is equal tonav-link
In that way, we can easy navigate between home and subpages by press on same element. For example
export default {
themeConfig: {
nav: [
{ nav-link: '/markdown-examples'},
{ nav-sub-link: '/'},
{ text: 'Markdown Examples', link: '/markdown-examples' }
]
}
}
Describe alternatives you've considered
No alternatives right now?
Additional context
And example about how it works now
https://github.com/user-attachments/assets/df4e051b-242c-4cbe-a3bd-8fa39ba25848
Validations
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.