diff --git a/README.md b/README.md index 04f04af8..88c56faf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # πŸ’Ž Coworkers πŸ’Ž -λžœλ”©νŽ˜μ΄μ§€ 이미지 (μΆ”κ°€ μ˜ˆμ •) +![open_graph](https://github.com/user-attachments/assets/8b7f79ce-1b21-46a6-bdff-5f4887d5ae11) +

@@ -52,11 +53,17 @@ ### 🧩 ν”„λ‘ νŠΈμ—”λ“œ -### πŸ›  μ½”λ“œ 포맀터 및 검사 도ꡬ - + +### πŸ›  μ½”λ“œ 포맀터 및 도ꡬ + + + ### 🀝 ν˜‘μ—… 도ꡬ + + ### πŸš€ 배포 ν”Œλž«νΌ +
diff --git a/src/app/[groupId]/editteam/page.tsx b/src/app/[groupId]/editteam/page.tsx index a996cf24..19e335a4 100644 --- a/src/app/[groupId]/editteam/page.tsx +++ b/src/app/[groupId]/editteam/page.tsx @@ -1,3 +1,5 @@ +import { Metadata } from "next"; +import { cookies } from "next/headers"; import EditTeam from "./_components/edit-team"; interface EditTeamPageProps { @@ -6,6 +8,55 @@ interface EditTeamPageProps { }>; } +async function getAccessToken() { + const cookieStore = await cookies(); + return cookieStore.get("accessToken")?.value; +} + +export async function generateMetadata({ + params, +}: EditTeamPageProps): Promise { + const { groupId } = await params; + const accessToken = await getAccessToken(); + + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/groups/${groupId}`, + { + headers: { + Authorization: `Bearer ${accessToken}`, + }, + } + ); + + const group = await res.json(); + if (!group) { + return { + title: "νŒ€ μ„€μ •", + description: "νŒ€ 정보λ₯Ό μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.", + }; + } + + return { + title: `${group.name} νŒ€ μ„€μ •`, + description: `${group.name} 정보λ₯Ό μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.`, + openGraph: { + title: `${group.name} νŒ€ μ„€μ • | Coworkers`, + description: `${group.name} 정보λ₯Ό μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.`, + type: "website", + url: `https://coworkers-pied.vercel.app/${groupId}/editteam`, + siteName: "Coworkers", + images: [ + { + url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg", + width: 1200, + height: 630, + alt: "Coworkers", + }, + ], + }, + }; +} + const EditTeamPage = async ({ params }: EditTeamPageProps) => { const { groupId } = await params; diff --git a/src/app/[groupId]/page.tsx b/src/app/[groupId]/page.tsx index de9166a8..ba92e4ff 100644 --- a/src/app/[groupId]/page.tsx +++ b/src/app/[groupId]/page.tsx @@ -1,3 +1,5 @@ +import { Metadata } from "next"; +import { cookies } from "next/headers"; import TeamPageClient from "./_components/team-page-client"; interface TeamPageProps { @@ -6,6 +8,55 @@ interface TeamPageProps { }>; } +async function getAccessToken() { + const cookieStore = await cookies(); + return cookieStore.get("accessToken")?.value; +} + +export async function generateMetadata({ + params, +}: TeamPageProps): Promise { + const { groupId } = await params; + const accessToken = await getAccessToken(); + + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/groups/${groupId}`, + { + headers: { + Authorization: `Bearer ${accessToken}`, + }, + } + ); + + const group = await res.json(); + if (!group) { + return { + title: "νŒ€νŽ˜μ΄μ§€", + description: "νŒ€ νŽ˜μ΄μ§€ 정보λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.", + }; + } + + return { + title: group.name, + description: `${group.name} 정보λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.`, + openGraph: { + title: `${group.name} | Coworkers`, + description: `${group.name} 정보λ₯Ό 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.`, + type: "website", + url: `https://coworkers-pied.vercel.app/${groupId}`, + siteName: "Coworkers", + images: [ + { + url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg", + width: 1200, + height: 630, + alt: "Coworkers", + }, + ], + }, + }; +} + const TeamPage = async ({ params }: TeamPageProps) => { const { groupId } = await params; diff --git a/src/app/noteam/page.tsx b/src/app/noteam/page.tsx index 45c342dd..3aa462ab 100644 --- a/src/app/noteam/page.tsx +++ b/src/app/noteam/page.tsx @@ -1,8 +1,30 @@ import { Button } from "@/components/index"; import cn from "@/utils/clsx"; +import type { Metadata } from "next"; import Image from "next/image"; import Link from "next/link"; +export const metadata: Metadata = { + title: "νŒ€ μ—†μŒ", + description: "아직 μ†Œμ†λœ νŒ€μ΄ μ—†μŠ΅λ‹ˆλ‹€.", + openGraph: { + title: "νŒ€ μ—†μŒ | Coworkers", + description: "아직 μ†Œμ†λœ νŒ€μ΄ μ—†μŠ΅λ‹ˆλ‹€.", + type: "website", + url: "https://coworkes.com/mypage", + locale: "ko_KR", + siteName: "Coworkers", + images: [ + { + url: "https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Coworkers/user/2449/open_graph.jpg", + width: 1200, + height: 630, + alt: "μ†Œμ†νŒ€ μ—†μŒ", + }, + ], + }, +}; + const NoTeam = () => { return (