Skip to content

Commit

Permalink
[#677] metadata에 프로덕션 URL만 노출되도록 수정 (#678)
Browse files Browse the repository at this point in the history
* 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으로 롤백
  • Loading branch information
hanyugeon authored Aug 8, 2024
1 parent 17a3db5 commit 004bc4f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/app/book/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
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(),
}));
}
2 changes: 1 addition & 1 deletion src/app/bookshelf/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
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(),
}));
}
2 changes: 1 addition & 1 deletion src/app/group/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
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(),
}));
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: '다독다독',
Expand Down
4 changes: 2 additions & 2 deletions src/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
};
}
6 changes: 3 additions & 3 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { default as bookGroupSitemap } from './group/sitemap';
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
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()),
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 @@
const baseUrl = new URL(`${process.env.NEXT_HOST}`);

export const navigationSchemaItems = [
{
'@type': 'SiteNavigationElement',
position: 1,
name: '북카이브',
description:
'같은 직군인 유저들의 책장과 인기 도서를 추천받고 인사이트를 넓혀보세요',
url: `${baseUrl}bookarchive`,
url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/bookarchive`,
},
{
'@type': 'SiteNavigationElement',
position: 2,
name: '도서검색',
description:
'평소에 궁금했거나 함께 이야기 나누고 싶은 도서를 검색해보세요',
url: `${baseUrl}book/search`,
url: `${process.env.NEXT_PUBLIC_PRODUCTION_URL}/book/search`,
},
{
'@type': 'SiteNavigationElement',
position: 3,
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`,
},
];

0 comments on commit 004bc4f

Please sign in to comment.