Improve frontmatter exclusion handling in search index generation

This commit is contained in:
Ben Edgington
2025-05-24 21:20:17 +01:00
parent 06017b3efa
commit da71298f8c
2 changed files with 27 additions and 21 deletions

View File

@@ -8,10 +8,10 @@ const searchIndex = [];
function isExcludedFrontmatter(frontmatter, exclude) {
for (let i = 0; i < exclude.frontmatter.length; i++) {
const test = exclude.frontmatter[i];
const key = Object.keys(test)[0];
const key = test.key;
if (
Object.prototype.hasOwnProperty.call(frontmatter, key) &&
frontmatter[key] == test[key]
frontmatter[key] == test.value
) {
return true;
}