From be6c3a6f9dea0b4413b47e74114f6b63e038e035 Mon Sep 17 00:00:00 2001 From: Dayong Lee Date: Sun, 14 Jan 2024 22:35:26 +0900 Subject: [PATCH] feat(fe): add metadata base option (#1156) --- .github/workflows/ci.yml | 1 + frontend-client/app/layout.tsx | 4 +++- frontend-client/lib/vars.ts | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f202a41e25..eec5e04f8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: if: ${{ matrix.target == 'frontend-client' }} run: | echo "NEXT_PUBLIC_BASEURL=https://dev.codedang.com/api" >> frontend-client/.env + echo "NEXT_URL=https://dev.codedang.com" >> frontend-client/.env # If target is backend-admin, run `pnpm --filter backend build admin` # For other targets, run `pnpm --filter build` diff --git a/frontend-client/app/layout.tsx b/frontend-client/app/layout.tsx index fb9a4a2836..8c6cc32127 100644 --- a/frontend-client/app/layout.tsx +++ b/frontend-client/app/layout.tsx @@ -1,4 +1,5 @@ import { cn } from '@/lib/utils' +import { metaBaseUrl } from '@/lib/vars' import type { Metadata, Viewport } from 'next' import { Manrope, Noto_Sans_KR } from 'next/font/google' import './globals.css' @@ -19,7 +20,8 @@ const manrope = Manrope({ export const metadata: Metadata = { title: 'Codedang 코드당', - description: 'Codedang, Online Judge for SKKU' + description: 'Codedang, Online Judge for SKKU', + metadataBase: metaBaseUrl ? new URL(metaBaseUrl) : null } export const viewport: Viewport = { diff --git a/frontend-client/lib/vars.ts b/frontend-client/lib/vars.ts index 052ab714bd..8697e13cce 100644 --- a/frontend-client/lib/vars.ts +++ b/frontend-client/lib/vars.ts @@ -1 +1,2 @@ export const baseUrl = process.env.NEXT_PUBLIC_BASEURL +export const metaBaseUrl = process.env.VERCEL_URL || process.env.NEXT_URL