-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: JSON-LD 추가 #76
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
Changes from 3 commits
06ff8c1
d1d607e
9e319a6
a478e44
054d253
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import './globals.css'; | |
|
||
import { Suspense } from 'react'; | ||
|
||
import { JsonLD } from '@/components'; | ||
import { Analytics } from '@/components/Analytics'; | ||
import { OverlayProvider } from '@/components/Overlay/OverlayProvider'; | ||
import METADATA from '@/constants/meta'; | ||
|
@@ -18,9 +19,8 @@ export default function RootLayout({ children }: PropsWithChildren) { | |
<html lang="ko"> | ||
<body className="flex justify-center w-screen touch-none bg-slate-100"> | ||
<div className="w-full overflow-scroll bg-white max-w-layout text-primary"> | ||
<Suspense> | ||
<Analytics /> | ||
</Suspense> | ||
<Analytics /> | ||
<JsonLD /> | ||
<QueryProvider> | ||
<RecoilProvider> | ||
<OverlayProvider>{children}</OverlayProvider> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 코드 패치는 대부분 좋아 보입니다. 개선 제안은 다음과 같습니다:
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. layout.tsx에서만 사용되는 컴포넌트인만큼,, 따로 빼서 컴포넌트 폴더를 늘리는 것 보다 한 파일 내에서 선언하면 좋을 것 같습니다..! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
정리하면, 가독성을 위해 컴포넌트는 분리하는 것이 좋다고 생각하며 저희가 최근에 구두로 정한 컴포넌트 구조 컨벤션처럼, layout.tsx에서 사용하는 컴포넌트는 layout.tsx와 동일한 depth에 작성하는 방안을 제안합니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 제안해주신 방안으로 진행하면 좋을 것 같습니다!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Script from 'next/script'; | ||
|
||
import { JSON_LD } from '@/constants'; | ||
|
||
export default function JsonLD() { | ||
return ( | ||
<Script | ||
id="faq-schema" | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify(JSON_LD), | ||
}} | ||
/> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as JsonLD } from './JsonLD'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './JsonLD'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './meta'; |
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.
JsonLD
컴포넌트를 가져오기 위해 새로운 import 문이 추가되었습니다. 이 코드 변경은 기능적인 면에서 안전합니다.RootLayout
함수 내에서<JsonLD />
컴포넌트가 Suspense 컴포넌트로 감싸여 있지 않습니다. 만약JsonLD
컴포넌트가 데이터를 비동기적으로 로드한다면, Suspense로 감쌀 것을 고려해 볼 수 있습니다.코드 리뷰에는 주로 더 많은 context나 페이지 전반의 처리 방식이 필요하지만, 해당 코드 조각 자체가 작아서 뚜렷한 문제점이 나타나지는 않습니다.
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.
React Suspense는 주로 비동기 작업(데이터 패칭, 지연 로딩 컴포넌트)을 처리하기 위해 사용합니다. JSON-LD스크립트는 정적 메타 데이터로, 비동기 로딩이 필요하지 않습니다.
또한, Suspense로 감싸면 서버에서 렌더링을 하지 않기 때문에 내부 컴포넌트의 렌더링에 있어서 지연이 발생해 SEO에 부정적인 영향을 미칠 수 있습니다.