Skip to content

Commit

Permalink
fix: 환경변수에 NEXT_DEPLOYMENT_URL 추가 및 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed Aug 6, 2024
1 parent 4823562 commit af3de21
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 24 deletions.
3 changes: 1 addition & 2 deletions src/app/book/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { MetadataRoute } from 'next';
import type { APIRecommendedBookshelf } from '@/types/bookshelf';
import type { APIBook } from '@/types/book';
import { DEPLOYMENT_URL } from '@/constants/url';

const options = {
headers: {
Expand Down Expand Up @@ -42,7 +41,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const sitemap = ['search', ...booksId];

return sitemap.map(value => ({
url: `${DEPLOYMENT_URL}/book/${value}`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/book/${value}`,
lastModified: new Date(),
}));
}
3 changes: 1 addition & 2 deletions src/app/bookshelf/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { MetadataRoute } from 'next';
import type { APIRecommendedBookshelf } from '@/types/bookshelf';
import { DEPLOYMENT_URL } from '@/constants/url';

const options = {
headers: {
Expand Down Expand Up @@ -35,7 +34,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const bookshelves = await bookshelvesSitemap();

return bookshelves.map(({ bookshelfId }) => ({
url: `${DEPLOYMENT_URL}/bookshelf/${bookshelfId}`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/bookshelf/${bookshelfId}`,
lastModified: new Date(),
}));
}
3 changes: 1 addition & 2 deletions src/app/group/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { MetadataRoute } from 'next';
import type { APIGroupPagination } from '@/types/group';
import { DEPLOYMENT_URL } from '@/constants/url';

const options = {
headers: {
Expand Down Expand Up @@ -33,7 +32,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const bookGroups = await bookGroupSitemap();

return bookGroups.map(bookGroupId => ({
url: `${DEPLOYMENT_URL}/group/${bookGroupId}`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/group/${bookGroupId}`,
lastModified: new Date(),
}));
}
3 changes: 1 addition & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Metadata } from 'next';

import { appleSplashScreens } from '@/constants/metadata';
import { DEPLOYMENT_URL } from '@/constants/url';

import GoogleAnalytics from '@/components/common/GoogleAnalytics';
import AuthFailedErrorBoundary from '@/components/common/AuthFailedErrorBoundary';
Expand All @@ -15,7 +14,7 @@ import { LineSeedKR } from '@/styles/font';
import '@/styles/global.css';

export const metadata: Metadata = {
metadataBase: new URL(`${DEPLOYMENT_URL}`),
metadataBase: new URL(`${process.env.NEXT_DEPLOYMENT_URL}`),
title: {
template: '%s | 다독다독',
default: '다독다독',
Expand Down
6 changes: 2 additions & 4 deletions src/app/robots.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import type { MetadataRoute } from 'next';

import { DEPLOYMENT_URL } from '@/constants/url';

export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
},
sitemap: `${DEPLOYMENT_URL}/sitemap.xml`,
host: `${DEPLOYMENT_URL}`,
sitemap: `${process.env.NEXT_DEPLOYMENT_URL}/sitemap.xml`,
host: `${process.env.NEXT_DEPLOYMENT_URL}`,
};
}
7 changes: 3 additions & 4 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { DEPLOYMENT_URL } from '@/constants/url';
import type { MetadataRoute } from 'next';

import { default as bookSitemap } from './book/sitemap';
Expand All @@ -8,15 +7,15 @@ import { default as bookGroupSitemap } from './group/sitemap';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
return [
{
url: `${DEPLOYMENT_URL}/bookarchive`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/bookarchive`,
lastModified: new Date(),
},
{
url: `${DEPLOYMENT_URL}/group`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/group`,
lastModified: new Date(),
},
{
url: `${DEPLOYMENT_URL}/profile/me`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/profile/me`,
lastModified: new Date(),
},
...(await bookSitemap()),
Expand Down
10 changes: 4 additions & 6 deletions src/constants/metadata/schema.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
import { DEPLOYMENT_URL } from '@/constants/url';

export const navigationSchemaItems = [
{
'@type': 'SiteNavigationElement',
position: 1,
name: '북카이브',
description:
'같은 직군인 유저들의 책장과 인기 도서를 추천받고 인사이트를 넓혀보세요',
url: `${DEPLOYMENT_URL}/bookarchive`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/bookarchive`,
},
{
'@type': 'SiteNavigationElement',
position: 2,
name: '도서검색',
description:
'평소에 궁금했거나 함께 이야기 나누고 싶은 도서를 검색해보세요',
url: `${DEPLOYMENT_URL}/book/search`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/book/search`,
},
{
'@type': 'SiteNavigationElement',
position: 3,
name: '독서모임',
description:
'읽고 싶은 책을 선정하고 모임에 참여하여 멤버들과 이야기를 나눠보세요',
url: `${DEPLOYMENT_URL}/group`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/group`,
},
{
'@type': 'SiteNavigationElement',
position: 4,
name: '내프로필',
description: '내 책장을 관리하고 참여한 독서 모임들을 확인해보세요',
url: `${DEPLOYMENT_URL}/profile/me`,
url: `${process.env.NEXT_DEPLOYMENT_URL}/profile/me`,
},
];
2 changes: 0 additions & 2 deletions src/constants/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ export const DATA_URL = {
};

export const KAKAO_LOGIN_BASE_URL = `${process.env.NEXT_PUBLIC_API_URL}/oauth2/authorize/kakao?redirect_uri=${process.env.NEXT_PUBLIC_CLIENT_REDIRECT_URI}`;

export const DEPLOYMENT_URL = 'https://dev.dadok.app';

0 comments on commit af3de21

Please sign in to comment.