Skip to content

feature request rework user navigation to be more clearer #1839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 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
119 changes: 82 additions & 37 deletions packages/docs/docs/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { fs, path } = require('@vuepress/shared-utils')
const { fs, path } = require('@vuepress/shared-utils');

module.exports = ctx => ({
dest: '../../vuepress',
Expand Down Expand Up @@ -43,10 +43,11 @@ module.exports = ctx => ({
lastUpdated: 'Last Updated',
nav: require('./nav/en'),
sidebar: {
'/api/': getApiSidebar(),
'/guide/': getGuideSidebar('Guide', 'Advanced'),
'/plugin/': getPluginSidebar('Plugin', 'Introduction', 'Official Plugins'),
'/theme/': getThemeSidebar('Theme', 'Introduction'),
'/plugin/market/': getPluginMarketSidebar(),
'/plugin/': getPluginSidebar('Plugin', 'Introduction'),
'/theme/market/': getPluginMarketSidebar(),
'/theme/': getThemeSidebar('Theme', 'Introduction')
}
},
'/zh/': {
Expand All @@ -56,9 +57,10 @@ module.exports = ctx => ({
lastUpdated: '上次更新',
nav: require('./nav/zh'),
sidebar: {
'/zh/api/': getApiSidebar(),
'/zh/guide/': getGuideSidebar('指南', '深入'),
'/zh/plugin/': getPluginSidebar('插件', '介绍', '官方插件'),
'/zh/plugin/market/': getPluginMarketSidebar('/zh'),
'/zh/plugin/': getPluginSidebar('插件', '介绍'),
'/zh/theme/market/': getPluginMarketSidebar('/zh'),
'/zh/theme/': getThemeSidebar('主题', '介绍')
}
}
Expand All @@ -77,28 +79,18 @@ module.exports = ctx => ({
['container', {
type: 'vue',
before: '<pre class="vue-container"><code>',
after: '</code></pre>',
after: '</code></pre>'
}],
['container', {
type: 'upgrade',
before: info => `<UpgradePath title="${info}">`,
after: '</UpgradePath>',
}],
after: '</UpgradePath>'
}]
],
extraWatchFiles: [
'.vuepress/nav/en.js',
'.vuepress/nav/zh.js',
]
})
extraWatchFiles: ['.vuepress/nav/en.js', '.vuepress/nav/zh.js']
});

function getApiSidebar () {
return [
'cli',
'node'
]
}

function getGuideSidebar (groupA, groupB) {
function getGuideSidebar(groupA, groupB) {
return [
{
title: groupA,
Expand All @@ -112,7 +104,7 @@ function getGuideSidebar (groupA, groupB) {
'markdown',
'using-vue',
'i18n',
'deploy',
'deploy'
]
},
{
Expand All @@ -125,15 +117,10 @@ function getGuideSidebar (groupA, groupB) {
'global-computed'
]
}
]
];
}

const officalPlugins = fs
.readdirSync(path.resolve(__dirname, '../plugin/official'))
.map(filename => 'official/' + filename.slice(0, -3))
.sort()

function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
function getPluginSidebar(pluginTitle, pluginIntro) {
return [
{
title: pluginTitle,
Expand All @@ -146,16 +133,74 @@ function getPluginSidebar (pluginTitle, pluginIntro, officialPluginTitle) {
'option-api',
'context-api'
]
}
];
}

function getPluginMarketSidebar(
lang = '',
Plugins = 'Plugins',
Themes = 'Themes',
Official = 'Official',
Community = 'Community'
) {
return [
{
title: Plugins,
collapsable: true,
children: [
{
title: Official,
collapsable: true,
children: [
lang + '/plugin/market/official/plugin-active-header-links',
lang + '/plugin/market/official/plugin-back-to-top',
lang + '/plugin/market/official/plugin-google-analytics',
lang + '/plugin/market/official/plugin-last-updated',
lang + '/plugin/market/official/plugin-medium-zoom',
lang + '/plugin/market/official/plugin-nprogress',
lang + '/plugin/market/official/plugin-pwa',
lang + '/plugin/market/official/plugin-register-components',
lang + '/plugin/market/official/plugin-search'
]
},
{
title: Community,
collapsable: true,
children: [
[
lang + '/plugin/market/before-writing-plugin',
'You want to create a plugin ?'
]
]
}
]
},
{
title: officialPluginTitle,
collapsable: false,
children: officalPlugins,
title: Themes,
collapsable: true,
children: [
{
title: Official,
collapsable: true,
children: [lang + '/theme/market/official/default-theme']
},
{
title: Community,
collapsable: true,
children: [
[
lang + '/theme/market/before-writing-theme',
'You want to create a theme ?'
]
]
}
]
}
]
];
}

function getThemeSidebar (groupA, introductionA) {
function getThemeSidebar(groupA, introductionA) {
return [
{
title: groupA,
Expand All @@ -169,6 +214,6 @@ function getThemeSidebar (groupA, introductionA) {
'default-theme-config',
'inheritance'
]
},
]
}
];
}
82 changes: 32 additions & 50 deletions packages/docs/docs/.vuepress/nav/en.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,56 @@
module.exports = [
{
text: "Guide",
link: "/guide/"
text: 'Guide',
link: '/guide/'
},
{
text: "Config Reference",
link: "/config/"
text: 'Plugins / Themes',
link: '/plugin/market/official/plugin-active-header-links'
},
{
text: "Plugin",
link: "/plugin/"
},
{
text: "Theme",
link: "/theme/"
},
{
text: "Learn More",
text: 'Learn More',
items: [
{
text: "API",
items: [
{
text: "CLI",
link: "/api/cli.html"
},
{
text: "Node",
link: "/api/node.html"
}
]
text: 'Config reference',
link: '/config/index.html'
},
{
text: "Contributing Guide",
items: [
{
text: "Local Development",
link: "/miscellaneous/local-development.html"
},
{
text: "Design Concepts",
link: "/miscellaneous/design-concepts.html"
},
{
text: "FAQ",
link: "/faq/"
},
{
text: "Glossary",
link: "/miscellaneous/glossary.html"
}
]
text: 'Cli',
link: '/api/cli.html'
},
{
text: 'Create a plugin',
link: '/plugin/index.html'
},
{
text: 'Create a theme',
link: '/theme/index.html'
},
{
text: 'NodeJS Api',
link: '/api/node.html'
},
{
text: 'Contributing Guide',
link: '/miscellaneous/local-development.html'
},
{
text: "Miscellaneous",
text: 'Miscellaneous',
items: [
{
text: "Migrate from 0.x",
link: "/miscellaneous/migration-guide.html"
text: 'Migrate from 0.x',
link: '/miscellaneous/migration-guide.html'
},
{
text: "Changelog",
link: "https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md"
text: 'Changelog',
link: 'https://github.com/vuejs/vuepress/blob/master/CHANGELOG.md'
}
]
}
]
},
{
text: "0.x",
link: "https://vuepress.vuejs.org/"
text: '0.x',
link: 'https://vuepress.vuejs.org/'
}
];
Loading