Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
feat: 🎸 Added search feature to /learn
Browse files Browse the repository at this point in the history
reimplementing the search feature

feat: 🎸 added missing packages

changed engineOptions

feat: 🎸 Added search feature to /learn

reimplementing the search feature

feat: 🎸 added missing packages

changed engineOptions
  • Loading branch information
benhalverson committed Mar 26, 2022
1 parent c12ec8f commit c4f56b3
Show file tree
Hide file tree
Showing 33 changed files with 14,817 additions and 23,666 deletions.
50 changes: 50 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,55 @@ module.exports = {
},
},
},
{
resolve: 'gatsby-plugin-local-search',
options: {
name: 'learn-pages',
engine: 'flexsearch',
engineOptions: {
tokenize: 'forward',
},
query: `
{
allMdx (filter: {frontmatter: {category: {eq: "learn"}}}){
edges {
node {
fields {
slug
}
id
rawBody
frontmatter {
title
description
category
}
}
}
}
}
`,

ref: 'id',
index: ['title', 'body', 'description', 'slug'],
store: ['id', 'title', 'body', 'description', 'slug'],
normalizer: ({ error, data }) => {
if (error) {
throw error;
}
return data.allMdx.edges.map(node => {
return {
id: node.node.id,
title: node.node.frontmatter.title,
body: node.node.rawBody,
description: node.node.frontmatter.description,
slug: node.node.fields.slug,
};
});
},
},
},
],
};
Loading

0 comments on commit c4f56b3

Please sign in to comment.