File tree 6 files changed +83
-15
lines changed
6 files changed +83
-15
lines changed Original file line number Diff line number Diff line change
1
+ import Head from 'next/head' ;
2
+ import React from 'react' ;
3
+
4
+ import { URL } from '../utils/cangeURL' ;
5
+
6
+ type Props = {
7
+ title : string ;
8
+ postId : number ;
9
+ image : string ;
10
+ } ;
11
+
12
+ const CustomHead : React . FC < Props > = ( props ) => {
13
+ return (
14
+ < >
15
+ < Head >
16
+ < title > OmnisCode</ title >
17
+ < link rel = "icon" href = "/favicon.ico" />
18
+
19
+ < meta property = "og:title" content = "OmnisCode" />
20
+ < meta property = "og:type" content = "website" />
21
+ < meta property = "og:url" content = { URL + '/post/' + props . postId } />
22
+ < meta property = "og:image" content = { props . image } />
23
+ < meta property = "og:site_name" content = "OmnisCode" />
24
+ < meta property = "og:description" content = { props . title } />
25
+ { /* Twitter設定 */ }
26
+ < meta name = "twitter:card" content = "summary_large_image" />
27
+ </ Head >
28
+ </ >
29
+ ) ;
30
+ } ;
31
+
32
+ export default CustomHead ;
Original file line number Diff line number Diff line change
1
+ import Head from 'next/head' ;
2
+ import React from 'react' ;
3
+
4
+ import { URL } from '../utils/cangeURL' ;
5
+
6
+ type Props = {
7
+ pageName : string ;
8
+ } ;
9
+
10
+ const DefaultHead : React . FC < Props > = ( props ) => {
11
+ return (
12
+ < >
13
+ < Head >
14
+ < title > OmnisCode</ title >
15
+ < link rel = "icon" href = "/favicon.ico" />
16
+ < meta property = "og:title" content = "OmnisCode" />
17
+ < meta property = "og:type" content = "website" />
18
+ { /* URL = https://omniscode.one */ }
19
+ < meta property = "og:url" content = { URL + '/' + props . pageName } />
20
+ < meta
21
+ property = "og:image"
22
+ content = "https://omniscode-og-image.vercel.app/package%20main%0A%0Aimport%20%22fmt%22%0A%0Afunc%20main()%20%7B%0A%20%20%20%20fmt.Println(%22hello%20world%22)%0A%7D.jpeg?theme=gradient-dark& lang = go "
23
+ />
24
+ < meta property = "og:site_name" content = "OmnisCode" />
25
+ < meta property = "og:description" content = "コードを共有するSNS" />
26
+ { /* Twitter設定 */ }
27
+ < meta name = "twitter:card" content = "summary_large_image" />
28
+ </ Head >
29
+ </ >
30
+ ) ;
31
+ } ;
32
+
33
+ export default DefaultHead ;
Original file line number Diff line number Diff line change 1
1
import { NextPage } from 'next' ;
2
- import Head from 'next/head' ;
3
2
import { Grid , TextField , Button } from '@material-ui/core' ;
4
3
import React from 'react' ;
5
4
5
+ import CustomHead from '../components/CustomHead' ;
6
+ import DefaultHead from '../components/DefaultHead' ;
7
+
8
+ /**
9
+ * CustomHeadは記事詳細ページ専用のコンポーネントです。
10
+ * ->使い方 35行目を参照
11
+ * DefaultHeadはその他のページで使うコンポーネントです。
12
+ * ->ベースURL以下のURLパラメータをpageNameに入れてください
13
+ */
14
+
6
15
const Signup : NextPage = ( ) => {
7
16
//登録ボタンが押されたときの処理
8
17
function submit ( ) : void {
@@ -26,20 +35,12 @@ const Signup: NextPage = () => {
26
35
}
27
36
return (
28
37
< >
29
- < Head >
30
- < title > OmnisCode</ title >
31
- < link rel = "icon" href = "/favicon.ico" />
32
-
33
- < meta property = "og:title" content = "OmnisCode" />
34
- < meta property = "og:type" content = "website" />
35
- < meta property = "og:url" content = "https://ocode.one" />
36
- < meta property = "og:image" content = "https://sample.png" />
37
- < meta property = "og:site_name" content = "OmnisCode" />
38
- < meta
39
- property = "og:description"
40
- content = "OmnisCode | コードを共有するSNS"
41
- />
42
- </ Head >
38
+ { /* <CustomHead
39
+ title="記事のタイトルを入れる"
40
+ postId={1}
41
+ image="OGP画像のパスが入ります。"
42
+ /> */ }
43
+ < DefaultHead pageName = "sinup" />
43
44
< Grid
44
45
container
45
46
alignItems = "center"
Original file line number Diff line number Diff line change
1
+ export const URL = 'http://localhost:3000' ;
2
+ //デプロイ時は https://omniscode.one に変更
You can’t perform that action at this time.
0 commit comments