-
Couldn't load subscription status.
- Fork 3
Qi1 126 블로그 seo 개선 #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "QI1-126-\uBE14\uB85C\uADF8-seo-\uAC1C\uC120"
Merged
Qi1 126 블로그 seo 개선 #111
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| 'use client'; | ||
|
|
||
| import { usePathname } from 'next/navigation'; | ||
| import { Footer } from './Footer'; | ||
|
|
||
| export default function ConditionalFooter() { | ||
| const pathname = usePathname(); | ||
|
|
||
| // 푸터를 숨길 경로들 | ||
| const hideFooterPaths = ['/login', '/signUp', '/certification']; | ||
| const shouldHideFooter = hideFooterPaths.includes(pathname); | ||
|
|
||
| if (shouldHideFooter) { | ||
| return null; | ||
| } | ||
|
|
||
| return <Footer />; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| 'use client'; | ||
|
|
||
| import { usePathname } from 'next/navigation'; | ||
| import { Header } from './Header'; | ||
|
|
||
| export default function ConditionalHeader() { | ||
| const pathname = usePathname(); | ||
|
|
||
| // 헤더를 숨길 경로들 | ||
| const hideHeaderPaths = ['/login', '/signUp', '/certification']; | ||
| const shouldHideHeader = hideHeaderPaths.includes(pathname); | ||
|
|
||
| if (shouldHideHeader) { | ||
| return null; | ||
| } | ||
|
|
||
| return <Header />; | ||
| } |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요. 헤더와 푸터를 특정 경로에서 숨기는 기능 추가 잘 보았습니다.
현재
ConditionalHeader와ConditionalFooter컴포넌트는 로직이 거의 동일하여 코드 중복이 발생하고 있습니다. 향후 유지보수성을 높이기 위해, 이 두 컴포넌트를 하나의 범용 컴포넌트(예:ConditionalRenderer)로 통합하는 것을 제안합니다. 이 방식은 코드를 더 간결하게 만들고, 숨김 처리할 경로 목록을 한 곳에서 관리할 수 있게 해줍니다.또한, 스타일 가이드에 따라 상수는
UPPER_SNAKE_CASE로, 컴포넌트는named export로 작성하는 것이 좋습니다.12아래는 제안하는 리팩토링 예시입니다.
1. 새로운 범용 컴포넌트 생성
2.
layout.tsx수정이 방법을 적용하면
conditional-header.tsx와conditional-footer.tsx파일이 필요 없게 됩니다.Style Guide References
Footnotes
상수는 UPPER_SNAKE_CASE를 사용해야 합니다. (link) ↩
Default export보다 named export를 선호합니다. (link) ↩