-
Notifications
You must be signed in to change notification settings - Fork 9
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
[meta-tags] 앱라우터용 메타태그 및 QaPageScript, DiscussionForumPostingScript를 추가합니다. #3500
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4aee0ab
메타테그 pages-router, app-router, structured-data 폴더 구분
dongoc 4fe3000
app router용 메타태그 추가
dongoc ccce774
구조화된 데이터에서 head 태그 제거, 파싱 오류 해결
dongoc 9564e66
qa script 및 discussionForumPosting script 추가
dongoc 57bc1c9
triple default meta export 추가
dongoc 3ed4873
type optional 수정
dongoc 3d7314f
addSchemaType 재귀 수정
dongoc e09119e
불필요한 undefined 제거
dongoc 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
20 changes: 20 additions & 0 deletions
20
packages/meta-tags/src/app-router/generate-apple-smart-banner-meta.ts
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,20 @@ | ||
import { Metadata } from 'next' | ||
|
||
import { DEFAULT_APP_ID } from '../constants' | ||
|
||
export function generateAppleSmartBannerMeta({ | ||
appId = DEFAULT_APP_ID, | ||
appPath = '/', | ||
}: { | ||
appId?: string | ||
appPath?: string | ||
} = {}): Metadata { | ||
const appUrlScheme = process.env.NEXT_PUBLIC_APP_URL_SCHEME || '' | ||
|
||
return { | ||
itunes: { | ||
appId, | ||
appArgument: `${appUrlScheme}://${appPath}`, | ||
}, | ||
} | ||
} |
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,10 @@ | ||
import { Metadata } from 'next' | ||
|
||
export function generateCommonMeta(): Metadata { | ||
return { | ||
icons: { | ||
apple: 'https://triple.guide/icons/favicon-152x152.png', | ||
}, | ||
manifest: '/manifest.json', | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/meta-tags/src/app-router/generate-essential-content-meta.ts
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,20 @@ | ||
import { Metadata } from 'next' | ||
|
||
export function generateEssentialContentMeta({ | ||
title, | ||
description, | ||
canonicalUrl, | ||
}: { | ||
title?: string | ||
description?: string | ||
canonicalUrl?: string | ||
} = {}): Metadata { | ||
return { | ||
title: title || process.env.NEXT_PUBLIC_DEFAULT_PAGE_TITLE || '', | ||
description: | ||
description || process.env.NEXT_PUBLIC_DEFAULT_PAGE_DESCRIPTION || '', | ||
alternates: { | ||
canonical: canonicalUrl, | ||
}, | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/meta-tags/src/app-router/generate-facebook-app-link-meta.ts
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,34 @@ | ||
import { Metadata } from 'next' | ||
|
||
import { DEFAULT_APP_ID, DEFAULT_APP_PACKAGE_NAME } from '../constants' | ||
|
||
export function generateFacebookAppLinkMeta({ | ||
appName: appNameFromProps, | ||
appId = DEFAULT_APP_ID, | ||
appPath = '/', | ||
appPackageName = DEFAULT_APP_PACKAGE_NAME, | ||
}: { | ||
appName?: string | ||
appId?: string | ||
appPath?: string | ||
appPackageName?: string | ||
} = {}): Metadata { | ||
const appName = appNameFromProps ?? '트리플' | ||
const appUrlScheme = process.env.NEXT_PUBLIC_APP_URL_SCHEME || '' | ||
const url = `${appUrlScheme}://${appPath}` | ||
|
||
return { | ||
appLinks: { | ||
ios: { | ||
app_name: appName, | ||
url, | ||
app_store_id: appId, | ||
}, | ||
android: { | ||
app_name: appName, | ||
url, | ||
package: appPackageName, | ||
}, | ||
}, | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
packages/meta-tags/src/app-router/generate-facebook-open-graph-meta.ts
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,40 @@ | ||
import { Metadata } from 'next' | ||
import { OpenGraphType } from 'next/dist/lib/metadata/types/opengraph-types' | ||
|
||
import { DEFAULT_OG_IMAGE } from '../constants' | ||
|
||
export function generateFacebookOpenGraphMeta({ | ||
title: titleFromProps, | ||
description: descriptionFromProps, | ||
canonicalUrl, | ||
type = 'website', | ||
locale = 'ko_KR', | ||
image = DEFAULT_OG_IMAGE, | ||
}: { | ||
title?: string | ||
description?: string | ||
canonicalUrl?: string | ||
type?: OpenGraphType | ||
locale?: string | ||
image?: { url: string; width?: number; height?: number } | ||
} = {}): Metadata { | ||
const title = titleFromProps || process.env.NEXT_PUBLIC_DEFAULT_PAGE_TITLE | ||
const description = | ||
descriptionFromProps || process.env.NEXT_PUBLIC_DEFAULT_PAGE_DESCRIPTION | ||
const url = | ||
canonicalUrl || | ||
(process.env.NEXT_PUBLIC_WEB_URL_BASE | ||
? `${process.env.NEXT_PUBLIC_WEB_URL_BASE}/auth-web` | ||
: undefined) | ||
|
||
return { | ||
openGraph: { | ||
title, | ||
description, | ||
url, | ||
type, | ||
locale, | ||
images: image, | ||
}, | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/meta-tags/src/app-router/generate-triple-default-meta.ts
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,17 @@ | ||
import { Metadata } from 'next' | ||
|
||
import { generateCommonMeta } from './generate-common-meta' | ||
import { generateEssentialContentMeta } from './generate-essential-content-meta' | ||
import { generateFacebookOpenGraphMeta } from './generate-facebook-open-graph-meta' | ||
import { generateFacebookAppLinkMeta } from './generate-facebook-app-link-meta' | ||
import { generateAppleSmartBannerMeta } from './generate-apple-smart-banner-meta' | ||
|
||
export function generateTripleDefaultMeta(): Metadata { | ||
return { | ||
...generateCommonMeta(), | ||
...generateEssentialContentMeta(), | ||
...generateFacebookOpenGraphMeta(), | ||
...generateFacebookAppLinkMeta(), | ||
...generateAppleSmartBannerMeta(), | ||
} | ||
} |
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,6 @@ | ||
export * from './generate-common-meta' | ||
export * from './generate-apple-smart-banner-meta' | ||
export * from './generate-essential-content-meta' | ||
export * from './generate-facebook-app-link-meta' | ||
export * from './generate-facebook-open-graph-meta' | ||
export * from './generate-triple-default-meta' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,12 +1,4 @@ | ||
export { ItemAvailability } from './types' | ||
export { EssentialContentMeta } from './essential-content-meta' | ||
export { CommonMeta } from './common-meta' | ||
export { AppleSmartBannerMeta } from './apple-smart-banner-meta' | ||
export { FacebookAppLinkMeta } from './facebook-app-link-meta' | ||
export { FacebookOpenGraphMeta } from './facebook-open-graph-meta' | ||
export { ThemeColorMeta } from './theme-color-meta' | ||
export { ArticleScript } from './article-script' | ||
export { BreadcrumbListScript } from './breadcrumb-list-script' | ||
export { ProductScript } from './product-script' | ||
export { LocalBusinessScript } from './local-business-script' | ||
export { ReviewScript } from './review-script' | ||
export * from './types' | ||
export * from './app-router' | ||
export * from './pages-router' | ||
export * from './structured-data' |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...meta-tags/src/apple-smart-banner-meta.tsx → .../pages-router/apple-smart-banner-meta.tsx
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
.../meta-tags/src/facebook-app-link-meta.tsx → ...c/pages-router/facebook-app-link-meta.tsx
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
2 changes: 1 addition & 1 deletion
2
...eta-tags/src/facebook-open-graph-meta.tsx → ...pages-router/facebook-open-graph-meta.tsx
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,6 @@ | ||
export { EssentialContentMeta } from './essential-content-meta' | ||
export { CommonMeta } from './common-meta' | ||
export { AppleSmartBannerMeta } from './apple-smart-banner-meta' | ||
export { FacebookAppLinkMeta } from './facebook-app-link-meta' | ||
export { FacebookOpenGraphMeta } from './facebook-open-graph-meta' | ||
export { ThemeColorMeta } from './theme-color-meta' |
4 changes: 2 additions & 2 deletions
4
packages/meta-tags/src/theme-color-meta.tsx → ...ags/src/pages-router/theme-color-meta.tsx
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
import Script from 'next/script' | ||
|
||
import { createScript } from '../utils' | ||
import { ArticleScriptProps } from '../types' | ||
|
||
export function ArticleScript(props: ArticleScriptProps) { | ||
const articleScript = createScript(props, 'Article') | ||
|
||
return ( | ||
<Script | ||
id="article-script" | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify(articleScript, null, '\t'), | ||
}} | ||
/> | ||
) | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/meta-tags/src/structured-data/breadcrumb-list-script.tsx
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,18 @@ | ||
import Script from 'next/script' | ||
|
||
import { createScript } from '../utils' | ||
import { BreadcrumbListScriptProps } from '../types' | ||
|
||
export function BreadcrumbListScript(props: BreadcrumbListScriptProps) { | ||
const breadcrumbScript = createScript(props, 'BreadcrumbList') | ||
|
||
return ( | ||
<Script | ||
id="breadcrumb-list-script" | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify(breadcrumbScript, null, '\t'), | ||
}} | ||
/> | ||
) | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/meta-tags/src/structured-data/discussion-forum-posting-script.tsx
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,20 @@ | ||
import Script from 'next/script' | ||
|
||
import { createScript } from '../utils' | ||
import { DiscussionForumPostingScriptProps } from '../types' | ||
|
||
export function DiscussionForumPostingScript( | ||
props: DiscussionForumPostingScriptProps, | ||
) { | ||
const discussionForumPosting = createScript(props, 'DiscussionForumPosting') | ||
|
||
return ( | ||
<Script | ||
id="discussion-forum-posting-script" | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify(discussionForumPosting, null, '\t'), | ||
}} | ||
/> | ||
) | ||
} |
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,7 @@ | ||
export { ArticleScript } from './article-script' | ||
export { BreadcrumbListScript } from './breadcrumb-list-script' | ||
export { ProductScript } from './product-script' | ||
export { LocalBusinessScript } from './local-business-script' | ||
export { ReviewScript } from './review-script' | ||
export { QaPageScript } from './qa-page-script' | ||
export { DiscussionForumPostingScript } from './discussion-forum-posting-script' |
21 changes: 21 additions & 0 deletions
21
packages/meta-tags/src/structured-data/local-business-script.tsx
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,21 @@ | ||
import Script from 'next/script' | ||
|
||
import { SCHEMA_SCRIPT_TYPE_MAP, createScript } from '../utils' | ||
import { LocalBusinessScriptProps } from '../types' | ||
|
||
export function LocalBusinessScript({ | ||
type, | ||
...props | ||
}: LocalBusinessScriptProps) { | ||
const localBusinessScript = createScript(props, SCHEMA_SCRIPT_TYPE_MAP[type]) | ||
|
||
return ( | ||
<Script | ||
id="local-business-script" | ||
type="application/ld+json" | ||
dangerouslySetInnerHTML={{ | ||
__html: JSON.stringify(localBusinessScript, null, '\t'), | ||
}} | ||
/> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.