This package reads folders in your workdir with a README.md file and appends it to your sidebar
npm i vue-sidebar-generator
or
yarn add vue-sidebar-generator
In config.js
let Sidebar = require("vue-sidebar-generator")
const init = () => {
let sidebar = Sidebar.autoSidebar(); // default path is "./"
return {
// rest of config options
sidebar: {
"/": sidebar
},
//config options
}
}
module.exports = init();
const init = () => {
const path = "./docs"
const sidebar = Sidebar.folderToSidebar(path)
return {
// rest of config options
sidebar: [
{
title: "",
collapsable: false,
children: sidebar
}
],
//config options
}
}
module.exports = init();
this will read all the markdown files in that folder and append to sidebar.
there is also an option to select which items to have in your sidebar. You can specify in README.md for workdir
---
title: title
sidebar: sideItem1, sideItem2, sideItem3
---
then in config.js
let sidebar = getSidebar();
project
|___.vuepress
| | config.js
|
|___post1
| | README.md
|
|___post2
| | README.md
|
|___post3
| | README.md
|
| package.json
| README.md
|
currently subfolders are not supported.