feat: 포스트 slug 영문화 및 레거시 slug 301 리다이렉트 적용#98
Merged
Conversation
- Post 모델에 legacySlug 배열 필드 추가 (구 slug 보관 및 인덱스) - 포스트 상세 페이지에서 legacySlug 조회 후 permanentRedirect 처리 - 45개 포스트 slug 영문화 마이그레이션 스크립트 추가 - Post 타입에 legacySlug?: string[] 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lean<{ slug: string }>() 으로 반환 타입을 지정해 TS2339 오류 해결
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 변경 사항 요약
검색엔진에 색인된 포스트 URL(한글 slug)을 영문 slug로 마이그레이션하면서 기존 URL의 SEO를 보호합니다.
Post 모델에
legacySlug배열 필드를 추가해 구 slug를 보관하고, 구 URL로 접근 시 새 URL로 영구 리다이렉트(308)합니다.또한 글 작성 시 사용자가 직접 영문 slug를 입력하도록 slug 입력 UI 및 유효성 검사를 추가했습니다.
🔄 변경 내용
SEO 마이그레이션
app/models/Post.ts— legacySlug 배열 필드 추가 (indexed, 이전 slug 누적 보관)app/posts/[slug]/page.tsx— permanentRedirect() 적용: 구 slug 접근 시 legacySlug 조회 후 새 URL로 308 리다이렉트app/migrate/migrateToEnglishSlug.ts— 45개 포스트 한글 slug to 영문 slug 마이그레이션 스크립트 (실행 완료)app/types/Post.d.ts— legacySlug 타입 추가slug 입력 UI
app/entities/post/write/PostMetadataForm.tsx— slug 입력 필드 추가, 한글 입력 차단, 수정 모드 비활성화app/hooks/post/usePost.ts— formData에 slug 필드 추가, PostBody에 slug 포함app/api/posts/route.ts— slug 수신, 패턴 검사(영문+숫자+하이픈), 중복 검사(409)app/lib/utils/validate/validate.ts— slug 필수 및 패턴 유효성 검사 추가에디터 리렌더링 최적화
app/entities/post/write/BlogForm.tsx— useMemo/useCallback으로 previewOptions, 핸들러 메모이제이션app/entities/post/write/PostMetadataForm.tsx— memo() 래핑app/hooks/post/usePost.ts,useCloudDraft.ts— 콜백 메모이제이션🔍 리다이렉트 동작 흐름
향후 slug를 다시 변경하더라도 legacySlug 배열에 누적되므로 히스토리가 보존됩니다.
✅ 체크리스트