Skip to content

Commit 01cbdcb

Browse files
committed
feat: 사이드바 항목에 카테고리 색상 표시 추가
1 parent 9bf7fe4 commit 01cbdcb

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

.vitepress/plugins/posts.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ async function handleHotUpdate(ctx: any) {
4343
console.log("📝 포스트 변경 감지, 목록 업데이트 중...");
4444
await executePostGeneration();
4545
console.log("✅ 포스트 목록 업데이트 완료!");
46-
console.log("📋 사이드바 업데이트를 위해 개발 서버를 재시작해주세요!");
47-
console.log(" 또는 Ctrl+C 후 yarn docs:dev 를 다시 실행하세요.");
48-
49-
triggerFullReload(ctx.server);
5046
} catch (error) {
5147
console.warn(
5248
"포스트 목록 생성 실패:",

.vitepress/plugins/sidebar.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { readdirSync, statSync, readFileSync, Dirent } from "fs";
22
import { join, extname, basename } from "path";
33
import type { DefaultTheme } from "vitepress";
44
import matter from "gray-matter";
5+
import { getCategoryColor } from "../../src/constants/colors";
56

67
interface SidebarItem {
78
text: string;
@@ -47,9 +48,10 @@ function generateSidebarItems(dir: string, basePath: string): SidebarItem[] {
4748

4849
for (const folder of folders.sort((a: Dirent, b: Dirent) => a.name.localeCompare(b.name))) {
4950
const folderBasePath = `${basePath}/${folder.name}`;
51+
const color = getCategoryColor(folder.name);
5052

5153
items.push({
52-
text: formatTitle(folder.name),
54+
text: `<span class="category-indicator" style="background-color: ${color};"></span>${formatTitle(folder.name)}`,
5355
link: `${folderBasePath}/`,
5456
});
5557
}

0 commit comments

Comments
 (0)