Skip to content

Commit 9daaa49

Browse files
committed
fix: move meta elements from _document to _app
1 parent 0360fec commit 9daaa49

File tree

2 files changed

+59
-47
lines changed

2 files changed

+59
-47
lines changed

pages/_app.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import * as React from "react"
2+
import { AppProps } from "next/app"
3+
import Head from "next/head"
4+
5+
const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => {
6+
return (
7+
<>
8+
<style jsx global>{`
9+
body {
10+
margin: 0px;
11+
font-family: sans-serif;
12+
line-height: 1.7;
13+
background-color: #fefefe;
14+
}
15+
`}</style>
16+
17+
<Head>
18+
<title>noavoice - presented by 望月のあ</title>
19+
<meta
20+
name="description"
21+
content="望月のあの声がいつでも聞けるサービス。疲れが取れない、辛いことがあった、そんなあなたに癒しを。"
22+
/>
23+
<link rel="shortcut icon" href="/static/images/icons/favicon.png" />
24+
<link rel="manifest" href="/manifest.json" />
25+
<link rel="apple-touch-icon" href="/static/images/icons/favicon.png"></link>
26+
<meta name="theme-color" content="#faa65f" />
27+
<meta name="twitter:card" content="summary_large_image" />
28+
<meta name="twitter:site" content="@_noach" />
29+
<meta name="twitter:title" content="のあぼいす" />
30+
<meta name="twitter:image" content="https://noavoice.now.sh/static/twitter-ogp.png" />
31+
<meta name="twitter:description" content="望月のあの声がいつでも聞けるサービス" />
32+
</Head>
33+
34+
<Component {...pageProps} />
35+
</>
36+
)
37+
}
38+
39+
export default MyApp

pages/_document.tsx

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,31 @@
1-
import Document, { DocumentContext, Head, Html, Main, NextScript } from "next/document"
1+
import Document, { Head, Html, Main, NextScript } from "next/document"
22

33
class MyDocument extends Document {
4-
static async getInitialProps(ctx: DocumentContext) {
5-
const initialProps = await Document.getInitialProps(ctx)
6-
return { ...initialProps }
7-
}
8-
94
render() {
105
return (
116
<Html lang="ja">
127
<Head>
13-
<title>noavoice - presented by 望月のあ</title>
14-
<meta
15-
name="description"
16-
content="望月のあの声がいつでも聞けるサービス。疲れが取れない、辛いことがあった、そんなあなたに癒しを。"
17-
></meta>
18-
<link rel="shortcut icon" href="/static/images/icons/favicon.png" />
19-
<link rel="manifest" href="/manifest.json" />
20-
<link rel="apple-touch-icon" href="/static/images/icons/favicon.png"></link>
21-
<meta name="theme-color" content="#faa65f" />
22-
<meta name="twitter:card" content="summary_large_image" />
23-
<meta name="twitter:site" content="@_noach" />
24-
<meta name="twitter:title" content="のあぼいす" />
25-
<meta name="twitter:image" content="https://noavoice.now.sh/static/twitter-ogp.png" />
26-
<meta name="twitter:description" content="望月のあの声がいつでも聞けるサービス" />
278
{/*
28-
<link rel="preconnect" href="https://fonts.gstatic.com/" crossOrigin></link>
29-
<link
30-
href="https://fonts.googleapis.com/css?family=Kosugi+Maru&display=swap&subset=japanese"
31-
rel="stylesheet"
32-
></link>
9+
<link rel="preconnect" href="https://fonts.gstatic.com/" crossOrigin />
10+
<link
11+
href="https://fonts.googleapis.com/css?family=Kosugi+Maru&display=swap&subset=japanese"
12+
rel="stylesheet"
13+
/>
14+
15+
<link rel="preconnect" href="https://www.google-analytics.com" crossOrigin="true" />
16+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-90236823-7" />
17+
<script
18+
dangerouslySetInnerHTML={{
19+
__html: `
20+
window.dataLayer = window.dataLayer || [];
21+
function gtag(){dataLayer.push(arguments);}
22+
gtag('js', new Date());
3323
34-
<link rel="preconnect" href="https://www.google-analytics.com" crossOrigin="true" />
35-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-90236823-7"></script>
36-
<script
37-
dangerouslySetInnerHTML={{
38-
__html: `
39-
window.dataLayer = window.dataLayer || [];
40-
function gtag(){dataLayer.push(arguments);}
41-
gtag('js', new Date());
42-
43-
gtag('config', 'UA-90236823-7');
44-
`
45-
}}
46-
></script>
47-
*/}
48-
<style>{`
49-
body {
50-
margin: 0px;
51-
font-family: sans-serif;
52-
line-height: 1.7;
53-
background-color: #fefefe;
54-
}
55-
`}</style>
24+
gtag('config', 'UA-90236823-7');
25+
`
26+
}}
27+
></script>
28+
*/}
5629
</Head>
5730
<body>
5831
<Main />

0 commit comments

Comments
 (0)