From b50ff521108a26ca15ccde0e92cb603eccaa8759 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 9 Apr 2018 12:11:49 -0400 Subject: [PATCH] fix nested README --- docs/.vuepress/config.js | 13 +++--- docs/test/README.md | 3 ++ lib/app/Content.js | 16 +++---- lib/default-theme/SideBar.vue | 55 +++++------------------- lib/default-theme/SidebarGroup.vue | 7 ++-- lib/default-theme/SidebarLink.vue | 67 ++++++++++++++++++++++++++++++ lib/prepare.js | 42 ++++++++++++------- 7 files changed, 128 insertions(+), 75 deletions(-) create mode 100644 docs/test/README.md create mode 100644 lib/default-theme/SidebarLink.vue diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 92c403c1..43f25456 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -14,20 +14,21 @@ module.exports = { { title: 'Guide', children: [ + ['/', 'Home'], '/getting-started', '/markdown', '/assets', '/using-vue', - '/config', - '/default-theme' + '/default-theme', + '/theming', + '/deploy' ] }, { - title: 'API Reference', + title: 'Config Reference', children: [ - ['/markdown#emoji', 'MMMMM'], - '/theming', - '/deploy' + '/config', + '/test/' ] } ], diff --git a/docs/test/README.md b/docs/test/README.md new file mode 100644 index 00000000..25afe9fe --- /dev/null +++ b/docs/test/README.md @@ -0,0 +1,3 @@ +# Test Page + +hello dude diff --git a/lib/app/Content.js b/lib/app/Content.js index 3e8792c5..4becd314 100644 --- a/lib/app/Content.js +++ b/lib/app/Content.js @@ -16,13 +16,15 @@ export default { updateMeta() }, render (h) { - const componentName = this.$page.path === '/' - ? 'index' - : this.$page.path - .replace(/^\//, '') - .replace(/\.html$/, '') - .replace(/\//g, '-') - return h('page-' + componentName) + return h(pathToComponentName(this.$page.path)) + } +} + +function pathToComponentName (path) { + if (path.charAt(path.length - 1) === '/') { + return `page${path.replace(/\//g, '-') + 'index'}` + } else { + return `page${path.replace(/\//g, '-').replace(/\.html$/, '')}` } } diff --git a/lib/default-theme/SideBar.vue b/lib/default-theme/SideBar.vue index c10e90bd..9059a57f 100644 --- a/lib/default-theme/SideBar.vue +++ b/lib/default-theme/SideBar.vue @@ -2,9 +2,7 @@