|
1 | 1 | const meta = require("./gatsby-meta-config") |
2 | 2 |
|
3 | | -module.exports = { |
4 | | - siteMetadata: { |
5 | | - title: meta.title, |
6 | | - description: meta.description, |
7 | | - author: meta.author, |
8 | | - siteUrl: meta.siteUrl, |
9 | | - lang: meta.lang, |
10 | | - utterances: { |
11 | | - repo: meta.utterances, |
12 | | - }, |
13 | | - postTitle: "All", |
14 | | - menuLinks: [ |
15 | | - { |
16 | | - link: "/", |
17 | | - name: "Home", |
18 | | - }, |
19 | | - { |
20 | | - link: "/about/", |
21 | | - name: "About", |
22 | | - }, |
23 | | - { |
24 | | - link: meta.links.github, |
25 | | - name: "Github", |
26 | | - }, |
27 | | - ], |
28 | | - plugins: [ |
29 | | - "gatsby-plugin-robots-txt", |
30 | | - "gatsby-plugin-sitemap", |
31 | | - "gatsby-plugin-feed", |
32 | | - ], |
| 3 | +const siteMetadata = { |
| 4 | + title: meta.title, |
| 5 | + description: meta.description, |
| 6 | + author: meta.author, |
| 7 | + siteUrl: meta.siteUrl, |
| 8 | + lang: meta.lang, |
| 9 | + utterances: { |
| 10 | + repo: meta.utterances, |
33 | 11 | }, |
34 | | - plugins: [ |
| 12 | + postTitle: "All", |
| 13 | + menuLinks: [ |
35 | 14 | { |
36 | | - resolve: "gatsby-plugin-alias-imports", |
37 | | - options: { |
38 | | - alias: { |
39 | | - Src: "src", |
40 | | - Components: "src/components", |
41 | | - Constants: "src/constants", |
42 | | - Hooks: "src/hooks", |
43 | | - Images: "src/images", |
44 | | - Layouts: "src/layouts", |
45 | | - Pages: "src/pages", |
46 | | - Posts: "src/posts", |
47 | | - Stores: "src/stores", |
48 | | - Styles: "src/styles", |
49 | | - Templates: "src/templates", |
50 | | - Types: "src/types", |
51 | | - Utils: "src/utils", |
52 | | - }, |
53 | | - extensions: ["js", "ts", "tsx"], |
54 | | - }, |
| 15 | + link: "/", |
| 16 | + name: "Home", |
55 | 17 | }, |
56 | 18 | { |
57 | | - resolve: "gatsby-source-filesystem", |
58 | | - options: { |
59 | | - name: "src", |
60 | | - path: `${__dirname}/src`, |
61 | | - }, |
| 19 | + link: "/about/", |
| 20 | + name: "About", |
62 | 21 | }, |
63 | 22 | { |
64 | | - resolve: "gatsby-source-filesystem", |
65 | | - options: { |
66 | | - name: "images", |
67 | | - path: `${__dirname}/src/images`, |
68 | | - }, |
| 23 | + link: meta.links.github, |
| 24 | + name: "Github", |
69 | 25 | }, |
70 | | - { |
71 | | - resolve: "gatsby-plugin-typography", |
72 | | - options: { |
73 | | - pathToConfigModule: "src/styles/typography", |
| 26 | + ], |
| 27 | +} |
| 28 | + |
| 29 | +const corePlugins = [ |
| 30 | + { |
| 31 | + resolve: "gatsby-source-filesystem", |
| 32 | + options: { |
| 33 | + name: "src", |
| 34 | + path: `${__dirname}/src`, |
| 35 | + }, |
| 36 | + }, |
| 37 | + { |
| 38 | + resolve: "gatsby-source-filesystem", |
| 39 | + options: { |
| 40 | + name: "images", |
| 41 | + path: `${__dirname}/src/images`, |
| 42 | + }, |
| 43 | + }, |
| 44 | +] |
| 45 | + |
| 46 | +const devPlugins = [ |
| 47 | + { |
| 48 | + resolve: "gatsby-plugin-alias-imports", |
| 49 | + options: { |
| 50 | + alias: { |
| 51 | + Src: "src", |
| 52 | + Components: "src/components", |
| 53 | + Constants: "src/constants", |
| 54 | + Hooks: "src/hooks", |
| 55 | + Images: "src/images", |
| 56 | + Layouts: "src/layouts", |
| 57 | + Pages: "src/pages", |
| 58 | + Posts: "src/posts", |
| 59 | + Stores: "src/stores", |
| 60 | + Styles: "src/styles", |
| 61 | + Templates: "src/templates", |
| 62 | + Types: "src/types", |
| 63 | + Utils: "src/utils", |
74 | 64 | }, |
| 65 | + extensions: ["js", "ts", "tsx"], |
75 | 66 | }, |
76 | | - { |
77 | | - resolve: "gatsby-transformer-remark", |
78 | | - options: { |
79 | | - plugins: [ |
80 | | - "gatsby-remark-copy-linked-files", |
81 | | - `gatsby-remark-copy-linked-files`, |
82 | | - { |
83 | | - resolve: "gatsby-remark-vscode", |
84 | | - options: { |
85 | | - theme: { |
86 | | - default: "Github Light Theme", |
87 | | - parentSelector: { |
88 | | - "body[data-theme=dark]": "Dark Github", |
89 | | - }, |
| 67 | + }, |
| 68 | + { |
| 69 | + resolve: "gatsby-plugin-typography", |
| 70 | + options: { |
| 71 | + pathToConfigModule: "src/styles/typography", |
| 72 | + }, |
| 73 | + }, |
| 74 | + "gatsby-plugin-react-helmet", |
| 75 | + "gatsby-plugin-typescript", |
| 76 | + "gatsby-plugin-styled-components", |
| 77 | +] |
| 78 | + |
| 79 | +const imagePlugins = [ |
| 80 | + "gatsby-plugin-image", |
| 81 | + "gatsby-plugin-sharp", |
| 82 | + "gatsby-transformer-sharp", |
| 83 | +] |
| 84 | + |
| 85 | +const markdownPlugins = [ |
| 86 | + { |
| 87 | + resolve: "gatsby-transformer-remark", |
| 88 | + options: { |
| 89 | + plugins: [ |
| 90 | + "gatsby-remark-copy-linked-files", |
| 91 | + { |
| 92 | + resolve: "gatsby-remark-vscode", |
| 93 | + options: { |
| 94 | + theme: { |
| 95 | + default: "Github Light Theme", |
| 96 | + parentSelector: { |
| 97 | + "body[data-theme=dark]": "Dark Github", |
90 | 98 | }, |
91 | | - extensions: ["vscode-theme-github-light", "dark-theme-github"], |
92 | 99 | }, |
| 100 | + extensions: ["vscode-theme-github-light", "dark-theme-github"], |
93 | 101 | }, |
94 | | - { |
95 | | - resolve: "gatsby-remark-images", |
96 | | - options: { |
97 | | - linkImagesToOriginal: false, |
98 | | - }, |
| 102 | + }, |
| 103 | + { |
| 104 | + resolve: "gatsby-remark-images", |
| 105 | + options: { |
| 106 | + linkImagesToOriginal: false, |
99 | 107 | }, |
100 | | - ], |
101 | | - }, |
| 108 | + }, |
| 109 | + ], |
102 | 110 | }, |
103 | | - { |
104 | | - resolve: "gatsby-plugin-manifest", |
105 | | - options: { |
106 | | - name: meta.title, |
107 | | - short_name: meta.title, |
108 | | - description: meta.description, |
109 | | - lang: meta.lang, |
110 | | - start_url: "/", |
111 | | - background_color: "#ffffff", |
112 | | - theme_color: "#ffffff", |
113 | | - display: "standalone", |
114 | | - icon: meta.favicon, |
115 | | - icon_options: { |
116 | | - purpose: "any maskable", |
| 111 | + }, |
| 112 | +] |
| 113 | + |
| 114 | +const searchPlugins = [ |
| 115 | + "gatsby-plugin-sitemap", |
| 116 | + "gatsby-plugin-robots-txt", |
| 117 | + { |
| 118 | + resolve: `gatsby-plugin-feed`, |
| 119 | + options: { |
| 120 | + query: ` |
| 121 | + { |
| 122 | + site { |
| 123 | + siteMetadata { |
| 124 | + title |
| 125 | + description |
| 126 | + siteUrl |
| 127 | + site_url: siteUrl |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | + `, |
| 132 | + feeds: [ |
| 133 | + { |
| 134 | + serialize: ({ query: { site, allMarkdownRemark } }) => { |
| 135 | + return allMarkdownRemark.edges.map(edge => { |
| 136 | + return Object.assign({}, edge.node.frontmatter, { |
| 137 | + description: edge.node.excerpt, |
| 138 | + date: edge.node.frontmatter.date, |
| 139 | + url: site.siteMetadata.siteUrl + edge.node.fields.slug, |
| 140 | + guid: site.siteMetadata.siteUrl + edge.node.fields.slug, |
| 141 | + custom_elements: [{ "content:encoded": edge.node.html }], |
| 142 | + }) |
| 143 | + }) |
| 144 | + }, |
| 145 | + query: ` |
| 146 | + { |
| 147 | + allMarkdownRemark( |
| 148 | + filter: { fileAbsolutePath: { regex: "/(posts/blog)/" } } |
| 149 | + sort: { order: DESC, fields: [frontmatter___date] }, |
| 150 | + ) { |
| 151 | + edges { |
| 152 | + node { |
| 153 | + excerpt |
| 154 | + html |
| 155 | + fields { slug } |
| 156 | + frontmatter { |
| 157 | + title |
| 158 | + date |
| 159 | + } |
| 160 | + } |
| 161 | + } |
| 162 | + } |
| 163 | + } |
| 164 | + `, |
| 165 | + output: "/rss.xml", |
| 166 | + title: `${meta.title}'s RSS Feed`, |
117 | 167 | }, |
| 168 | + ], |
| 169 | + }, |
| 170 | + }, |
| 171 | +] |
| 172 | + |
| 173 | +const pwaPlugins = [ |
| 174 | + { |
| 175 | + resolve: "gatsby-plugin-manifest", |
| 176 | + options: { |
| 177 | + name: meta.title, |
| 178 | + short_name: meta.title, |
| 179 | + description: meta.description, |
| 180 | + lang: meta.lang, |
| 181 | + start_url: "/", |
| 182 | + background_color: "#ffffff", |
| 183 | + theme_color: "#ffffff", |
| 184 | + display: "standalone", |
| 185 | + icon: meta.favicon, |
| 186 | + icon_options: { |
| 187 | + purpose: "any maskable", |
118 | 188 | }, |
119 | 189 | }, |
120 | | - "gatsby-plugin-image", |
121 | | - "gatsby-plugin-sharp", |
122 | | - "gatsby-transformer-sharp", |
123 | | - "gatsby-plugin-styled-components", |
124 | | - "gatsby-plugin-offline", |
125 | | - "gatsby-plugin-react-helmet", |
126 | | - "gatsby-plugin-typescript", |
| 190 | + }, |
| 191 | + "gatsby-plugin-offline", |
| 192 | +] |
| 193 | + |
| 194 | +module.exports = { |
| 195 | + siteMetadata, |
| 196 | + plugins: [ |
| 197 | + ...corePlugins, |
| 198 | + ...devPlugins, |
| 199 | + ...imagePlugins, |
| 200 | + ...markdownPlugins, |
| 201 | + ...searchPlugins, |
| 202 | + ...pwaPlugins, |
127 | 203 | ], |
128 | 204 | } |
0 commit comments