vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

Make Nav URL customisable for home page and subpages

Open air3ijai opened this issue 4 months ago • 3 comments

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 to nav-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

air3ijai avatar Sep 26 '24 11:09 air3ijai