Skip to content

Commit

Permalink
feat: 폴더 구조에 맞게 설정 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkim0 committed Dec 29, 2023
1 parent fe51095 commit 4ab72a6
Showing 1 changed file with 29 additions and 9 deletions.
38 changes: 29 additions & 9 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic'
import type * as Preset from '@docusaurus/preset-classic';

import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
Expand All @@ -25,15 +25,35 @@ const config: Config = {
'classic',
{
docs: {
path: 'content/wiki',
path: 'content/10 Wiki',
routeBasePath: 'wiki',
sidebarPath: require.resolve('./sidebars.ts'),
showLastUpdateTime: true,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
const items = await defaultSidebarItemsGenerator(args);

function stripNumberPrefix(item) {
if (item.type === 'doc') {
const match = /^(\d{2}|\d{2}\.\d{2}) (.+)/.exec(item.label);
return {...item, label: match ? match[2] : item.label};
} else if (item.type === 'category') {
const match = /^(\d{2}|\d{2}\.\d{2}) (.+)/.exec(item.label);
return {
...item,
label: match ? match[2] : item.label,
items: item.items.map(stripNumberPrefix)
};
}
return item;
}

return items.map(stripNumberPrefix);
}
},
blog: {
path: 'content/posts',
path: 'content/20 Posts',
blogTitle: 'Posts',
blogDescription: 'Posts',
blogSidebarCount: 'ALL',
Expand Down Expand Up @@ -87,16 +107,16 @@ const config: Config = {
style: 'dark',
links: [
{
label: 'Docs Tags',
to: 'docs/tags'
label: 'Wiki Tags',
to: 'wiki/tags'
},
{
label: 'Blog Tags',
to: 'blog/tags',
label: 'Posts Tags',
to: 'posts/tags',
},
{
label: 'Blog Archive',
to: 'blog/archive',
label: 'Posts Archive',
to: 'posts/archive',
},
],
copyright: `Copyright © ${new Date().getFullYear()} jmkim0. Built with Docusaurus.`,
Expand Down

0 comments on commit 4ab72a6

Please sign in to comment.