diff --git a/src/app/(Main)/feed/page.tsx b/src/app/(Main)/feed/page.tsx index 6364bc41..80456314 100644 --- a/src/app/(Main)/feed/page.tsx +++ b/src/app/(Main)/feed/page.tsx @@ -8,6 +8,7 @@ import { PageAnimation } from '@/components/PageAnimation'; export const metadata: Metadata = { title: '포즈피드', + description: '포즈피드에서 조건에 맞는 포즈를 찾고, 친구한테 공유해보세요', }; export default function Feed() { diff --git a/src/app/(Main)/pick/page.tsx b/src/app/(Main)/pick/page.tsx index 1ac51476..d418386b 100644 --- a/src/app/(Main)/pick/page.tsx +++ b/src/app/(Main)/pick/page.tsx @@ -4,6 +4,7 @@ import PickSection from './components/PickSection'; export const metadata: Metadata = { title: '포즈픽', + description: '시간 없을 땐 포즈픽으로 빠르게 랜덤 포즈를 추천받아보세요.', }; export default function Pick() { diff --git a/src/app/(Main)/talk/page.tsx b/src/app/(Main)/talk/page.tsx index 88119168..ef8b7f5b 100644 --- a/src/app/(Main)/talk/page.tsx +++ b/src/app/(Main)/talk/page.tsx @@ -7,6 +7,7 @@ import { Spacing } from '@/components/Spacing'; export const metadata: Metadata = { title: '포즈톡', + description: '포즈톡에서 뽑은 랜덤 제시어로 나만의 개성있는 포즈를 완성해보세요.', }; export default function Talk() { diff --git a/src/app/(Sub)/detail/[id]/page.tsx b/src/app/(Sub)/detail/[id]/page.tsx index 538db3e4..2fa56a5d 100644 --- a/src/app/(Sub)/detail/[id]/page.tsx +++ b/src/app/(Sub)/detail/[id]/page.tsx @@ -1,4 +1,5 @@ import { QueryAsyncBoundary } from '@suspensive/react-query'; +import { Metadata, ResolvingMetadata } from 'next'; import DetailHeader from './components/DetailHeader'; import DetailSection from './components/DetailSection'; @@ -8,6 +9,26 @@ import { Loading } from '@/components/Loading'; import { PageAnimation } from '@/components/PageAnimation'; import { HydrationProvider } from '@/components/Provider/HydrationProvider'; +export async function generateMetadata( + { params }: { params: { id: string } }, + parent: ResolvingMetadata +): Promise { + const id = parseInt(params.id); + const { + poseInfo: { peopleCount, frameCount, tagAttributes }, + } = await getPoseDetail(id); + const description = `${tagAttributes},${frameCount}컷,${peopleCount}인 포즈추천`; + const defaultOgTitle = (await parent).openGraph?.title; + + return { + description, + openGraph: { + title: defaultOgTitle, + description: '이 포즈는 어때요?', + }, + }; +} + export default function DetailPage({ params }: { params: { id: number } }) { const { id } = params; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 05925bbc..94a72c80 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -12,17 +12,17 @@ import RecoilContextProvider from '@/provider/RecoilContextProvider'; import type { Metadata } from 'next'; -const DEFAULT_OG_TITLE = 'PosePicker'; -const DEFAULT_OG_DESC = '다음 포즈 뭐하지? 포즈피커가 포즈 고민을 해결해 드릴게요!'; -const DEFAULT_OG_IMAGE = '/images/main_star.png'; +const META_TITLE = 'PosePicker'; +const META_DESCRIPTION = '다음 포즈 뭐하지? 포즈피커가 포즈고민을 해결해 드릴게요!'; +const META_OG_IMAGE = '/images/main_star.png'; export const metadata: Metadata = { metadataBase: new URL(BASE_SITE_URL), title: { - default: DEFAULT_OG_TITLE, - template: `${DEFAULT_OG_TITLE} | %s`, + default: `${META_TITLE} - 포즈피커`, + template: `${META_TITLE} | %s`, }, - description: '다음 포즈 뭐하지? 포즈피커의 포즈 추천으로 포즈 고민을 해결해 드릴게요!', + description: META_DESCRIPTION, verification: { google: 'MB7qV_Oa4G4gR0jHgjtnE6S4g4blocE2mjo7z-z2f6Q', }, @@ -30,14 +30,14 @@ export const metadata: Metadata = { 'naver-site-verification': '65f3aba9349cce28018ac7a97d4f87ff00709aa3', }, openGraph: { - title: DEFAULT_OG_TITLE, - description: DEFAULT_OG_DESC, - images: [DEFAULT_OG_IMAGE], + title: META_TITLE, + description: META_DESCRIPTION, + images: [META_OG_IMAGE], }, twitter: { - title: DEFAULT_OG_TITLE, - description: DEFAULT_OG_DESC, - images: [DEFAULT_OG_IMAGE], + title: META_TITLE, + description: META_DESCRIPTION, + images: [META_OG_IMAGE], }, viewport: { width: 'device-width', diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts new file mode 100644 index 00000000..327642e0 --- /dev/null +++ b/src/app/sitemap.ts @@ -0,0 +1,22 @@ +import { getPoseFeed } from '@/apis'; +import { URL } from '@/constants/url'; + +export default async function sitemap() { + const baseUrl = URL.site; + + const { + filteredContents: { content }, + } = await getPoseFeed(0, 0, '', 0); + const detailUrls = content.map(({ poseInfo }) => ({ + url: `${baseUrl}/detail/${poseInfo.poseId}`, + lastModified: poseInfo.updatedAt, + })); + + return [ + { url: baseUrl, lastModified: new Date() }, + { url: `${baseUrl}/pick`, lastModified: new Date() }, + { url: `${baseUrl}/talk`, lastModified: new Date() }, + { url: `${baseUrl}/feed`, lastModified: new Date() }, + ...detailUrls, + ]; +} diff --git a/src/app/sitemap.xml b/src/app/sitemap.xml deleted file mode 100644 index 0e720390..00000000 --- a/src/app/sitemap.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - https://www.posepicker.site/pick - 2023-09-08T15:55:51+00:00 - 1.00 - - - https://www.posepicker.site/menu - 2023-09-08T15:55:51+00:00 - 0.80 - - - https://www.posepicker.site/talk - 2023-09-08T15:55:51+00:00 - 0.80 - - - https://www.posepicker.site/feed - 2023-09-08T15:55:51+00:00 - 0.80 - - - https://www.posepicker.site/bookmark - 2023-09-08T15:55:51+00:00 - 0.80 - - - https://www.posepicker.site/detail/undefined - 2023-09-08T15:55:51+00:00 - 0.64 - - \ No newline at end of file diff --git a/src/constants/url.ts b/src/constants/url.ts index 335b3f38..0313fdba 100644 --- a/src/constants/url.ts +++ b/src/constants/url.ts @@ -1,4 +1,5 @@ export const URL = { + site: 'https://www.posepicker.site', inquiry: 'https://docs.google.com/forms/d/e/1FAIpQLSeZuPZTXnO4rZ4k39SzXv96PWAW4gLcTYBrsRUrgRHSVV9Ldg/viewform?usp=sf_link', };