Skip to content

Commit

Permalink
[#657] 네비게이션 스키마 작성 (#660)
Browse files Browse the repository at this point in the history
* feat: 네비게이션 스키마 마크업

* chore: constants 메타데이터 import export문 수정

* feat: 네비게이션 스키마 적용

* refactor: NavigationSchemaScript 컴포넌트 분리
  • Loading branch information
hanyugeon authored Jul 11, 2024
1 parent f34d416 commit ecc1840
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import AuthFailedErrorBoundary from '@/components/common/AuthFailedErrorBoundary
import PWAServiceWorkerProvider from '@/components/common/PWAServiceWorkerProvider';
import ReactQueryProvider from '@/components/common/ReactQueryProvider';
import ToastProvider from '@/components/common/Toast/ToastProvider';
import NavigationSchemaScript from '@/components/common/NavigationSchemaScript';
import Layout from '@/components/layout/Layout';

import { LineSeedKR } from '@/styles/font';
Expand Down Expand Up @@ -52,6 +53,7 @@ const RootLayout = ({ children }: { children: React.ReactNode }) => {
</ReactQueryProvider>
</ToastProvider>
</PWAServiceWorkerProvider>
<NavigationSchemaScript />
</body>
</html>
);
Expand Down
21 changes: 21 additions & 0 deletions src/components/common/NavigationSchemaScript.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Script from 'next/script';

import { navigationSchemaItems } from '@/constants/metadata/schema';

const navigationSchema = {
'@context': 'https://schema.org',
'@type': 'ItemList',
itemListElement: navigationSchemaItems,
};

const NavigationSchemaScript = () => {
return (
<Script
id="navigation-schema"
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(navigationSchema) }}
/>
);
};

export default NavigationSchemaScript;
4 changes: 1 addition & 3 deletions src/constants/metadata/appleSplashScreens.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const appleSplashScreens = [
export const appleSplashScreens = [
{
rel: 'apple-touch-startup-image',
media:
Expand Down Expand Up @@ -228,5 +228,3 @@ const appleSplashScreens = [
url: '/images/splash-screens/8.3__iPad_Mini_portrait.png',
},
];

export default appleSplashScreens;
3 changes: 2 additions & 1 deletion src/constants/metadata/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default as appleSplashScreens } from './appleSplashScreens';
export * from './appleSplashScreens';
export * from './schema';
35 changes: 35 additions & 0 deletions src/constants/metadata/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const baseUrl = new URL(`${process.env.NEXT_HOST}`);

export const navigationSchemaItems = [
{
'@type': 'SiteNavigationElement',
position: 1,
name: '북카이브',
description:
'같은 직군인 유저들의 책장과 인기 도서를 추천받고 인사이트를 넓혀보세요',
url: `${baseUrl}bookarchive`,
},
{
'@type': 'SiteNavigationElement',
position: 2,
name: '도서검색',
description:
'평소에 궁금했거나 함께 이야기 나누고 싶은 도서를 검색해보세요',
url: `${baseUrl}book/search`,
},
{
'@type': 'SiteNavigationElement',
position: 3,
name: '독서모임',
description:
'읽고 싶은 책을 선정하고 모임에 참여하여 멤버들과 이야기를 나눠보세요',
url: `${baseUrl}group`,
},
{
'@type': 'SiteNavigationElement',
position: 4,
name: '내프로필',
description: '내 책장을 관리하고 참여한 독서 모임들을 확인해보세요',
url: `${baseUrl}profile/me`,
},
];

0 comments on commit ecc1840

Please sign in to comment.