-
Notifications
You must be signed in to change notification settings - Fork 7
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
[SP2] head 태그 컴포넌트로 분리 및 프로젝트별 og tag 적용 #209
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import Head from 'next/head'; | ||
|
||
interface HeadProps { | ||
projectTitle?: string; | ||
projectID?: string; | ||
projectImageURL?: string; | ||
} | ||
|
||
function HTMLHead(props: HeadProps) { | ||
const { projectTitle, projectID, projectImageURL } = props; | ||
|
||
return ( | ||
<Head> | ||
<title>SOPT</title> | ||
<meta | ||
name="description" | ||
content="SOPT는 IT와 벤처 창업에 뜻이 있는 대학생들이 모인 국내 최대 규모의 대학생 연합 IT 벤처 창업 동아리입니다." | ||
/> | ||
<meta name="title" content="SOPT" /> | ||
<meta name="keyword" content="IT, 창업, 개발, 대학생, 동아리" /> | ||
<meta name="viewport" content="initial-scale=1.0, width=device-width" /> | ||
|
||
<meta name="apple-mobile-web-app-title" content="SOPT" /> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | ||
|
||
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png" /> | ||
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png" /> | ||
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png" /> | ||
<link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png" /> | ||
<link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png" /> | ||
<link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png" /> | ||
<link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png" /> | ||
<link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png" /> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png" /> | ||
<link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png" /> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /> | ||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png" /> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" /> | ||
|
||
<link rel="manifest" href="/manifest.json" /> | ||
<meta name="msapplication-TileColor" content="#ffffff" /> | ||
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png" /> | ||
<meta name="theme-color" content="#ffffff" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1" | ||
/> | ||
<meta content="yes" name="apple-mobile-web-app-capable" /> | ||
|
||
{/* Twitter */} | ||
<meta name="twitter:title" content="SOPT" /> | ||
<meta name="twitter:description" content="대학생 연합 IT 벤처 창업 동아리" /> | ||
<meta property="twitter:card" content="website" /> | ||
<meta property="twitter:site" content="https://sopt.org/" /> | ||
<meta | ||
name="twitter:image" | ||
content="https://s3.ap-northeast-2.amazonaws.com/sopt.org/admin/origin/img_sopt_homepage.png" | ||
/> | ||
<meta property="twitter:image:alt" content="SOPT 공식 홈페이지 이미지" /> | ||
|
||
{/* Open Graph */} | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:locale" content="ko_KR" /> | ||
<meta | ||
property="og:url" | ||
content={`https://sopt.org/project/${projectID}` || 'https://sopt.org/'} | ||
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. 삼항 연산자를 안 쓰고 이렇게도 표현할 수 있는 건가요 ..?!!? 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. <meta property="og:title" content={`SOPT 프로젝트 ${projectTitle}` || 'SOPT'} /> 이렇게 작성한 코드가 로컬에서 테스트했을때도 정상적으로 작동이 됩니다! 그 이유는 projectTitle가 없으면(falsy) 좌측 코드가 실행되지 않고 있으면 실행되는 구조입니다. |
||
/> | ||
<meta property="og:title" content={`SOPT 프로젝트 ${projectTitle}` || 'SOPT'} /> | ||
<meta property="og:site_name" content="SOPT 공식 홈페이지" /> | ||
<meta property="og:description" content={'대학생 연합 IT 벤처 창업 동아리'} /> | ||
<meta | ||
property="og:image" | ||
content={ | ||
projectImageURL || | ||
'https://s3.ap-northeast-2.amazonaws.com/sopt.org/admin/origin/img_sopt_homepage.png' | ||
} | ||
/> | ||
<meta property="og:image:alt" content="SOPT 공식 홈페이지 이미지" /> | ||
</Head> | ||
); | ||
} | ||
|
||
export default HTMLHead; |
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
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.
컴포넌트 이름이 HTMLHead인 이유는 무엇인가요 ..?!?
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.
Head 태그를 통째로 담고 있어서 그렇게 지었습니다! 더 좋은 네임명이 있으면 추천 부탁드려요1!
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.
CustomHead..? 생각해봤는데 마땅한 게 떠오르지 않아서 HTMLHead도 좋은 거 같습니다!