Skip to content
Draft
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
29 changes: 29 additions & 0 deletions docs/search-index.11ty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports =
class SearchIndex {
constructor() {}
data() {
// Export Front Matter
return {
permalink: "/search-index.jsonl",
eleventyExcludeFromCollections: true
};
}
render(data) {
let str = "";

for (const pageIdx in data.collections.all) {
const page = data.collections.all[pageIdx];
if (page.page.outputFileExtension === "html") {
// Only include HTML content into our Search Index File
const obj = {
url: page.url,
title: page.data.title,
body: page.content
};
str += `${JSON.stringify(obj)}\n`;
}
}

return str;
}
}