-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: SEO 개선 작업 진행 (metadata, sitemap, robots.txt) #243
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b2865ea
feat: layout 컴포넌트의 metadata 수정 - 리스티웨이브 한글 타이틀 추가 및 description 수정
ParkSohyunee 35dd8e5
Feat: 마이리스트, 콜라보리스트 페이지에 Dynamic 메타데이터 설정
ParkSohyunee cbda4ce
Feat: 리스트 상세 페이지에 Dynamic 메타데이터 설정
ParkSohyunee f88c4de
Refactor: 메타데이터 별도 상수로 분리
ParkSohyunee 11067a4
Feat: sitemap 설정 및 도메인 url 별도 상수로 분리
ParkSohyunee e564f46
Feat: 트렌딩리스트에 해당하는 리스트의 상세페이지가 sitemap에 추가되도록 설정
ParkSohyunee 3647990
Feat: robots.txt 설정
ParkSohyunee 1eace2e
Fix: sitemap.ts 트랜딩리스트 호출 방법을 fetch API로 수정
ParkSohyunee 8e64130
Fix: sitemap.ts 트랜딩리스트 호출 로직 제거
ParkSohyunee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import DOMAIN_URL from '@/lib/constants/domain'; | ||
import type { MetadataRoute } from 'next'; | ||
|
||
export default function robots(): MetadataRoute.Robots { | ||
return { | ||
rules: { | ||
userAgent: '*', | ||
allow: '/', | ||
}, | ||
sitemap: `${DOMAIN_URL}/sitemap.xml`, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { MetadataRoute } from 'next'; | ||
import DOMAIN_URL from '@/lib/constants/domain'; | ||
|
||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> { | ||
return [ | ||
{ | ||
url: DOMAIN_URL, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
priority: 1, | ||
}, | ||
{ | ||
url: `${DOMAIN_URL}/intro`, | ||
lastModified: new Date(), | ||
changeFrequency: 'yearly', | ||
priority: 0.8, | ||
}, | ||
{ | ||
url: `${DOMAIN_URL}/search`, | ||
lastModified: new Date(), | ||
changeFrequency: 'weekly', | ||
priority: 0.8, | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
import { Metadata } from 'next'; | ||
import { Metadata, ResolvingMetadata } from 'next'; | ||
|
||
import Profile from '../_components/Profile'; | ||
import Content from '../_components/Content'; | ||
import FloatingContainer from '@/components/floatingButton/FloatingContainer'; | ||
import PlusOptionFloatingButton from '@/components/floatingButton/PlusOptionFloatingButton'; | ||
import ArrowUpFloatingButton from '@/components/floatingButton/ArrowUpFloatingButton'; | ||
|
||
import axiosInstance from '@/lib/axios/axiosInstance'; | ||
import { UserType } from '@/lib/types/userProfileType'; | ||
import METADATA from '@/lib/constants/metadata'; | ||
|
||
interface MyListPageProps { | ||
params: { | ||
userId: number; | ||
}; | ||
params: { userId: number }; | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: 'My List', | ||
description: '나의 취향을 기록한 나만의 리스트 입니다.', | ||
}; | ||
export async function generateMetadata({ params }: MyListPageProps, parent: ResolvingMetadata): Promise<Metadata> { | ||
const userId = params.userId; | ||
const { data } = await axiosInstance.get<UserType>(`/users/${userId}`); | ||
|
||
const previousImages = (await parent).openGraph?.images || []; | ||
|
||
return { | ||
title: { | ||
absolute: `${data.nickname}'s Mylist`, | ||
}, | ||
authors: [{ name: `${data.nickname}` }], | ||
description: METADATA.description.mylist, | ||
openGraph: { | ||
description: `${data.description || METADATA.description.mylist}`, | ||
url: `${METADATA.url}/user/${userId}/mylist`, | ||
images: [`${data.profileImageUrl}`, ...previousImages], | ||
}, | ||
}; | ||
} | ||
Comment on lines
+23
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 웅와........ |
||
|
||
export default function MyListPage({ params }: MyListPageProps) { | ||
return ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const DOMAIN_URL = 'https://listywave.com'; | ||
|
||
export default DOMAIN_URL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import DOMAIN_URL from './domain'; | ||
|
||
const METADATA = { | ||
title: { | ||
template: '%s | ListyWave', // Template Object | ||
default: 'ListyWave | 리스티웨이브', | ||
openGraph: 'ListyWave', | ||
}, | ||
description: { | ||
default: | ||
"나의 취향을 리스트로 기록하고, 공유하고, 발견해요. 리스티웨이브에서 모든 기준은 '나의 취향'이에요. 내 취향 가득한 편안한 공간이 되면 좋겠습니다.", | ||
mylist: '나의 취향을 기록한 리스트 입니다.', | ||
collabolist: '콜라보레이터와 함께 기록한 콜라보 리스트 입니다.', | ||
}, | ||
authors: { | ||
name: '에잇🩷', | ||
url: 'https://github.com/8-Sprinters', | ||
}, | ||
generator: 'Next.js', | ||
applicationName: 'ListyWave', | ||
referrer: 'origin-when-cross-origin', // Referrer-Policy | ||
keywords: ['ListyWave', 'list', '리스티웨이브'], | ||
url: DOMAIN_URL, | ||
type: 'website', | ||
siteName: 'ListyWave', | ||
locale: 'ko', | ||
}; | ||
|
||
export default METADATA; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 페이지마다 설정해주면 SEO가 되는거군요..! 🤩