Skip to content

Commit a654626

Browse files
committed
fix: 태그를 nullable로 변경
1 parent 87fce57 commit a654626

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/components/blog/post-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface PostCardProps {
1010
description?: string;
1111
created: string;
1212
category: string;
13-
tags: string[];
13+
tags?: string[];
1414
series?: string;
1515
order?: number;
1616
}

src/components/blog/post-meta-badges.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CategoryBadge, SeriesBadge, TagBadge } from "./badges";
22

33
interface PostMetaBadgesProps {
44
category: string;
5-
tags: string[];
5+
tags?: string[];
66
series?: string;
77
order?: number;
88
seriesCount?: number;
@@ -28,7 +28,7 @@ export default function PostMetaBadges({
2828
className={linkClassName}
2929
/>
3030
)}
31-
{tags.map((tag) => (
31+
{tags?.map((tag) => (
3232
<TagBadge key={tag} tag={tag} className={linkClassName} />
3333
))}
3434
</>

src/lib/posts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function getPostsByCategory(category: string): Post[] {
1919

2020
// 태그 필터
2121
export function getPostsByTag(tag: string): Post[] {
22-
return getAllPosts().filter((p) => p.tags.includes(tag));
22+
return getAllPosts().filter((p) => p.tags?.includes(tag));
2323
}
2424

2525
// 시리즈 필터 (order 순 정렬)
@@ -54,7 +54,7 @@ export function getAllCategories(): { name: string; count: number }[] {
5454
export function getAllTags(): { name: string; count: number }[] {
5555
const map = new Map<string, number>();
5656
for (const p of posts) {
57-
for (const tag of p.tags) {
57+
for (const tag of p.tags ?? []) {
5858
map.set(tag, (map.get(tag) ?? 0) + 1);
5959
}
6060
}

src/lib/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface SearchItem {
66
title: string;
77
description: string;
88
category: string;
9-
tags: string[];
9+
tags?: string[];
1010
content: string;
1111
}
1212

0 commit comments

Comments
 (0)