Skip to content

feat: allow showing a dropdown on site title #835

Closed
@rigor789

Description

@rigor789

Feature request

What problem does this feature solve?

I was browsing the vue-router docs, and wanted to jump to the vuex docs. Currently there is no "easy" way to do this, and what I would consider a convenient solution is if the current site title was a dropdown with a list of related sites.

What does the proposed API look like?

// .vuepress/config.js
module.exports = {
  themeConfig: {
    sites: [
      { text: 'Vue Router', link: 'https://router.vuejs.org' },
      { text: 'Vuex', link: 'https://vuex.vuejs.org' },
    ]
  }
}

How should this be implemented in your opinion?

I believe we can easily implement this by reusing the existing DropdownLink component

And a new branch in the Navbar component

<span
ref="siteName"
class="site-name"
v-if="$siteTitle"
:class="{ 'can-hide': $site.themeConfig.logo }"
>{{ $siteTitle }}</span>

      <!-- sitesLinks would be a computed property so that it can automatically add $siteTitle as the root elements text -->
      <DropdownLink v-if="sites" :item="sitesLinks" />
      <span
        ref="siteName"
        class="site-name"
        v-else-if="$siteTitle"
        :class="{ 'can-hide': $site.themeConfig.logo }"
       >{{ $siteTitle }}</span>

Are you willing to work on this yourself?**

If this is something useful for anyone, sure!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions