Skip to content

Commit 17680d1

Browse files
committed
Feat: 카테고리 한글과 공백지원을 위한 url encode와 decode 기능 추가
1 parent 0a7e3e6 commit 17680d1

File tree

5 files changed

+3
-27
lines changed

5 files changed

+3
-27
lines changed

app/(blog)/posts/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function generateStaticParams() {
1515
}
1616

1717
return posts.map((post) => ({
18-
slug: decodeURIComponent(post.urlPath).split("/"),
18+
slug: post.urlPath.split("/").map(segment => encodeURIComponent(segment)),
1919
}));
2020
}
2121

components/post-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const PostCard = ({
5353
(summary || plainContent || content).substring(0, 150) + "...";
5454

5555
return (
56-
<Link href={`/posts/${urlPath}`} className="block h-full">
56+
<Link href={`/posts/${encodeURIComponent(urlPath)}`} className="block h-full">
5757
<motion.div
5858
className="h-full group overflow-hidden rounded-lg border border-border bg-card shadow-sm hover:shadow-md"
5959
whileHover={{

content/posts/resource/SWEA/SWEA 강의 정리노트.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

lib/posts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export async function getPost(slug: string[]): Promise<Post | null> {
137137
return null;
138138
}
139139

140+
// URL로 전달된 인코딩된 슬러그를 디코딩
140141
const urlPath = slug.join("/").replace(/\/+/g, "/").replace(/\.md$/, "");
141142

142143
try {

public/post-contents/resource/SWEA/SWEA 강의 정리노트.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)