Skip to content

Commit

Permalink
package: upgrade vitepress-sidebar package
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Nov 1, 2024
1 parent 0dc8cb5 commit b7639b0
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 127 deletions.
23 changes: 13 additions & 10 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generateSidebar } from 'vitepress-sidebar';
import { VitePressSidebarOptions, withSidebar } from 'vitepress-sidebar';
import { defineConfig, UserConfig } from 'vitepress';
import { withI18n } from 'vitepress-i18n';
import { VitePressI18nOptions } from 'vitepress-i18n/dist/types';
Expand All @@ -15,6 +15,15 @@ const vitePressI18nConfig: VitePressI18nOptions = {
}
};

const vitePressSidebarConfig: VitePressSidebarOptions = {
documentRootPath: 'docs',
collapseDepth: 2,
capitalizeFirst: true,
underscoreToSpace: true,
useTitleFromFileHeading: true,
useTitleFromFrontmatter: true
};

// Ref: https://vitepress.vuejs.org/config/introduction
const vitePressConfig: UserConfig = {
title: name.toUpperCase(),
Expand All @@ -39,14 +48,6 @@ const vitePressConfig: UserConfig = {
editLink: {
pattern: 'https://github.com/jooy2/til/edit/master/docs/:path'
},
sidebar: generateSidebar({
documentRootPath: 'docs',
collapseDepth: 2,
capitalizeFirst: true,
underscoreToSpace: true,
useTitleFromFileHeading: true,
useTitleFromFrontmatter: true
}),
nav: [
{
text: 'Blog',
Expand All @@ -60,4 +61,6 @@ const vitePressConfig: UserConfig = {
}
};

export default defineConfig(withI18n(vitePressConfig, vitePressI18nConfig));
export default defineConfig(
withSidebar(withI18n(vitePressConfig, vitePressI18nConfig), vitePressSidebarConfig)
);
Loading

0 comments on commit b7639b0

Please sign in to comment.