-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.ts
172 lines (165 loc) · 4.38 KB
/
gatsby-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import type { GatsbyConfig } from "gatsby";
import { GetSlug } from "./src/api/getSlug";
require('dotenv').config();
const config: GatsbyConfig = {
siteMetadata: {
title: `Atrevete`,
description: "Atreveteは日本の課題でもある「若者の育成をどうしていくか」に着目し、「夢がある」「迷いながらも一歩を踏み出したい」そんなあなたのためのイベントを開催します。",
siteUrl: process.env.SITEURL,
social: {
twitter: "",
}
},
// More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense.
// If you use VSCode you can also use the GraphQL plugin
// Learn more at: https://gatsby.dev/graphql-typegen
graphqlTypegen: true,
plugins: [{
resolve: 'gatsby-source-contentful',
options: {
"accessToken": process.env.ACCESSTOKEN,
"spaceId": process.env.SPACEID,
enableTags: true,
}
}, "gatsby-plugin-image", {
resolve: `gatsby-plugin-sharp`,
options: {
defaults: {
formats: [`webp`],
placeholder: `blurred`,
quality: 50,
breakpoints: [750, 1080, 1366, 1920],
backgroundColor: `transparent`,
blurredOptions: {},
jpgOptions: {},
pngOptions: {},
webpOptions: {},
avifOptions: {},
},
},
}, "gatsby-transformer-sharp", "gatsby-plugin-emotion", {
resolve: 'gatsby-plugin-sitemap',
options: {
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
nodes {
path
}
}
allContentfulPost {
nodes {
title
slug
updatedAt(formatString: "YYYY-MM-DDTHH:mm:ssZ")
}
}
allContentfulEvent {
nodes {
title
slug
updatedAt(formatString: "YYYY-MM-DDTHH:mm:ssZ")
}
}
}
`,
resolveSiteUrl: ({site: { siteMetadata: {siteUrl} }}) => siteUrl,
resolvePages: ({
allSitePage: { nodes: allPages },
allContentfulPost: { nodes: posts },
allContentfulEvent: { nodes: events },
}) => {
let postMap = posts.reduce((acc, post) => {
const { title, updatedAt } = post
acc[`/post/${GetSlug(post)}/`] = {updatedAt}
return acc
}, {})
const allMap = events.reduce((acc, post) => {
const { title, updatedAt } = post
acc[`/event/${GetSlug(post)}/`] = {updatedAt}
return acc
}, postMap)
return allPages.map(page => {
return { ...page, ...allMap[page.path] }
})
},
excludes: ['/404?(.*)', '/eventForm', '/thanks'],
serialize: ({ path, updatedAt }) => {
const site = {
url: path,
changefreq: `daily`,
priority: updatedAt ? 0.7 : 0.5,
}
if (!updatedAt) return site
return {
url: path,
lastmod: updatedAt,
}
},
},
}, {
resolve: 'gatsby-plugin-robots-txt',
options: {
host: process.env.SITEURL,
sitemap: `${process.env.SITEURL}/sitemap-index.xml`,
env: {
development: {
policy: [{userAgent: '*', disallow: ['/']}]
},
production: {
policy: [{userAgent: '*', allow: '/', disallow: ['/thanks','/404?(.*)', '/api']}]
}
},
}
},
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl: process.env.SITEURL,
stripQueryString: true,
},
},
{
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [process.env.GOOGLE_ANALYTICS],
pluginConfig: {
head: true, // headタグに記載されるように
}
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `markdown`,
path: `${__dirname}/src/markdown`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: 'images',
path: `${__dirname}/static`,
},
},
`gatsby-transformer-remark`,
`gatsby-plugin-netlify`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Atrevete`,
short_name: `Atrevete`,
lang: `ja`,
start_url: `/`,
display: `standalone`,
icon: `static/favicon.svg`
},
},
]
};
export default config;