-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgatsby-config.js
97 lines (97 loc) · 2.36 KB
/
gatsby-config.js
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
/* eslint-env node */
module.exports = {
mapping: {
'MarkdownRemark.frontmatter.authors': 'MarkdownRemark.fields.author_id',
'MarkdownRemark.frontmatter.editorial': 'MarkdownRemark.fields.editorial_id',
'MarkdownRemark.fields.posts': 'MarkdownRemark',
},
plugins: [
'gatsby-plugin-netlify-cache',
'gatsby-plugin-lodash',
'gatsby-plugin-styled-components',
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-plugin-nprogress',
options: {
color: '#29d',
showSpinner: false,
},
},
{
resolve: 'gatsby-plugin-eslint',
options: {
test: /\.js$|\.jsx$/,
exclude: /(node_modules|cache|public)/,
options: {
emitWarning: true,
failOnError: false,
},
},
},
{
resolve: 'gatsby-source-git',
options: {
name: 'campus-online-content',
remote: 'https://github.com/campus-online/content.git',
branch: 'master',
// articles needs to be processed after others,
// keep it last in the array
patterns: ['docs/authors/*.md', 'docs/editorials/*.md', 'docs/about/*.md', 'docs/articles/*.md'],
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'pages',
path: `${__dirname}/src/pages`,
},
},
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
'gatsby-remark-null-image-alt',
{
resolve: 'gatsby-remark-figure-caption',
options: {
figureClassName: 'md-figure',
captionClassName: 'md-figure-caption',
},
},
'gatsby-remark-external-links',
'gatsby-remark-responsive-iframe',
],
},
},
{
resolve: 'gatsby-transformer-campus-templates',
options: {
templateNameByFolder: {
authors: 'author',
articles: 'article',
editorials: 'editorial',
about: 'about',
},
},
},
'gatsby-transformer-campus-post',
{
resolve: '@leonardodino/gatsby-plugin-page-creator',
options: {
path: `${__dirname}/src/indexes`,
createPath: (basePath, filePath, createPath) => {
const url = createPath(basePath, filePath)
const slug = {
articles: 'materias',
authors: 'reporteres',
editorials: 'editorias',
tags: 'tags',
}[url.replace(/\/([^/]+)\/?$/, '$1')]
if(!slug) throw new Error(`unknown index for: "${url}"`)
return `/${slug}/`
},
},
},
'gatsby-plugin-netlify', // make sure to keep it last in the array
],
}