From 004bc4fbe23ce3e0307004ecb0b7e2f3d24e9282 Mon Sep 17 00:00:00 2001 From: harry kim <73218463+hanyugeon@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:25:01 +0900 Subject: [PATCH] =?UTF-8?q?[#677]=20metadata=EC=97=90=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EB=8D=95=EC=85=98=20URL=EB=A7=8C=20=EB=85=B8=EC=B6=9C=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#678)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: DEPLOYMENT_URL 컨스턴트 추가 * fix: sitemap.xml에 url 수정 * fix: robots.txt url 수정 * fix: metadata에 metadataBase url 수정 * fix: 네비게이션 스키마의 url 수정 * fix: 환경변수에 NEXT_DEPLOYMENT_URL 추가 및 적용 * fix: NEXT_DEPLOYMENT_URL을 NEXT_PUBLIC_PRODUCTION_URL로 수정 * fix: NEXT_PUBLIC_PRODUCTION_URL을 NEXT_PRODUCTION_URL로 수정 * fix: NEXT_PUBLIC_PRODUCTION_URL으로 롤백 --- src/app/book/sitemap.ts | 2 +- src/app/bookshelf/sitemap.ts | 2 +- src/app/group/sitemap.ts | 2 +- src/app/layout.tsx | 2 +- src/app/robots.ts | 4 ++-- src/app/sitemap.ts | 6 +++--- src/constants/metadata/schema.ts | 10 ++++------ 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/app/book/sitemap.ts b/src/app/book/sitemap.ts index bfdfa7f2..a880a367 100644 --- a/src/app/book/sitemap.ts +++ b/src/app/book/sitemap.ts @@ -41,7 +41,7 @@ export default async function sitemap(): Promise { const sitemap = ['search', ...booksId]; return sitemap.map(value => ({ - url: `${process.env.NEXT_HOST}/book/${value}`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/book/${value}`, lastModified: new Date(), })); } diff --git a/src/app/bookshelf/sitemap.ts b/src/app/bookshelf/sitemap.ts index d19ed0ee..7fbe64ba 100644 --- a/src/app/bookshelf/sitemap.ts +++ b/src/app/bookshelf/sitemap.ts @@ -34,7 +34,7 @@ export default async function sitemap(): Promise { const bookshelves = await bookshelvesSitemap(); return bookshelves.map(({ bookshelfId }) => ({ - url: `${process.env.NEXT_HOST}/bookshelf/${bookshelfId}`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/bookshelf/${bookshelfId}`, lastModified: new Date(), })); } diff --git a/src/app/group/sitemap.ts b/src/app/group/sitemap.ts index e963145b..538eb076 100644 --- a/src/app/group/sitemap.ts +++ b/src/app/group/sitemap.ts @@ -32,7 +32,7 @@ export default async function sitemap(): Promise { const bookGroups = await bookGroupSitemap(); return bookGroups.map(bookGroupId => ({ - url: `${process.env.NEXT_HOST}/group/${bookGroupId}`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/group/${bookGroupId}`, lastModified: new Date(), })); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ac829bba..de4da8ac 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -14,7 +14,7 @@ import { LineSeedKR } from '@/styles/font'; import '@/styles/global.css'; export const metadata: Metadata = { - metadataBase: new URL(`${process.env.NEXT_HOST}`), + metadataBase: new URL(`${process.env.NEXT_PUBLIC_PRODUCTION_URL}`), title: { template: '%s | 다독다독', default: '다독다독', diff --git a/src/app/robots.ts b/src/app/robots.ts index 90f25b69..7708c84c 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -6,7 +6,7 @@ export default function robots(): MetadataRoute.Robots { userAgent: '*', allow: '/', }, - sitemap: `${process.env.NEXT_HOST}/sitemap.xml`, - host: `${process.env.NEXT_HOST}`, + sitemap: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/sitemap.xml`, + host: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}`, }; } diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 3c01196e..bc8979ca 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -7,15 +7,15 @@ import { default as bookGroupSitemap } from './group/sitemap'; export default async function sitemap(): Promise { return [ { - url: `${process.env.NEXT_HOST}/bookarchive`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/bookarchive`, lastModified: new Date(), }, { - url: `${process.env.NEXT_HOST}/group`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/group`, lastModified: new Date(), }, { - url: `${process.env.NEXT_HOST}/profile/me`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/profile/me`, lastModified: new Date(), }, ...(await bookSitemap()), diff --git a/src/constants/metadata/schema.ts b/src/constants/metadata/schema.ts index d05c5aa7..8df8e84a 100644 --- a/src/constants/metadata/schema.ts +++ b/src/constants/metadata/schema.ts @@ -1,5 +1,3 @@ -const baseUrl = new URL(`${process.env.NEXT_HOST}`); - export const navigationSchemaItems = [ { '@type': 'SiteNavigationElement', @@ -7,7 +5,7 @@ export const navigationSchemaItems = [ name: '북카이브', description: '같은 직군인 유저들의 책장과 인기 도서를 추천받고 인사이트를 넓혀보세요', - url: `${baseUrl}bookarchive`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/bookarchive`, }, { '@type': 'SiteNavigationElement', @@ -15,7 +13,7 @@ export const navigationSchemaItems = [ name: '도서검색', description: '평소에 궁금했거나 함께 이야기 나누고 싶은 도서를 검색해보세요', - url: `${baseUrl}book/search`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/book/search`, }, { '@type': 'SiteNavigationElement', @@ -23,13 +21,13 @@ export const navigationSchemaItems = [ name: '독서모임', description: '읽고 싶은 책을 선정하고 모임에 참여하여 멤버들과 이야기를 나눠보세요', - url: `${baseUrl}group`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/group`, }, { '@type': 'SiteNavigationElement', position: 4, name: '내프로필', description: '내 책장을 관리하고 참여한 독서 모임들을 확인해보세요', - url: `${baseUrl}profile/me`, + url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/profile/me`, }, ];