|
1 | 1 | import { GatsbyConfig } from "gatsby"; |
| 2 | +import { authorName } from "./src/logic/blog-authors"; |
2 | 3 |
|
3 | 4 | require("dotenv").config(); |
4 | 5 |
|
@@ -223,6 +224,41 @@ const config: GatsbyConfig = { |
223 | 224 | queries: require("./src/logic/algolia"), |
224 | 225 | }, |
225 | 226 | }, |
| 227 | + { |
| 228 | + resolve: `gatsby-plugin-lunr`, |
| 229 | + options: { |
| 230 | + languages: [ |
| 231 | + { |
| 232 | + name: "en", |
| 233 | + filterNodes: (node: any) => !!node.frontmatter, |
| 234 | + }, |
| 235 | + ], |
| 236 | + fields: [ |
| 237 | + { name: "title", store: true, attributes: { boost: 20 } }, |
| 238 | + { name: "content", store: true }, |
| 239 | + { name: "slug", store: true }, |
| 240 | + { name: "description", store: true }, |
| 241 | + { name: "authors", store: true }, |
| 242 | + ], |
| 243 | + filterNodes: (node: any) => !!node.frontmatter, |
| 244 | + resolvers: { |
| 245 | + MarkdownRemark: { |
| 246 | + title: (node: any) => node.frontmatter.title, |
| 247 | + content: (node: any) => node.rawMarkdownBody, |
| 248 | + slug: (node: any) => node.fields.slug, |
| 249 | + description: (node: any) => node.frontmatter.description, |
| 250 | + authors: (node: any) => |
| 251 | + node.frontmatter.authors.map((author: string) => |
| 252 | + authorName(author), |
| 253 | + ), |
| 254 | + }, |
| 255 | + }, |
| 256 | + filename: "search_index.json", |
| 257 | + fetchOptions: { |
| 258 | + credentials: "same-origin", |
| 259 | + }, |
| 260 | + }, |
| 261 | + }, |
226 | 262 | ], |
227 | 263 | }; |
228 | 264 |
|
|
0 commit comments