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

Should send plain text to algolia for searching rather than send full markdown content #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require("dotenv").config();
const removeMarkdown = require("remove-markdown");
const config = require("./content/meta/config");

const query = `{
Expand All @@ -24,7 +25,13 @@ const query = `{
const queries = [
{
query,
transformer: ({ data }) => data.allMarkdownRemark.edges.map(({ node }) => node)
transformer: ({ data }) =>
data.allMarkdownRemark.edges.map(({ node }) => {
if (node.internal && node.internal.content) {
node.internal.content = removeMarkdown(node.internal.content).substring(1, 1000);
}
return node;
})
}
];

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"rebound": "^0.1.0",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
"remove-markdown": "^0.3.0",
"screenfull": "^3.3.2"
}
}