diff --git a/content/document.js b/content/document.js index 42625ba9848c..2eb0662bbbcb 100644 --- a/content/document.js +++ b/content/document.js @@ -448,8 +448,11 @@ function findAll({ return false; } + const locale = filePath.replace(root, "").split(path.sep)[1]; + if (!VALID_LOCALES.has(locale)) { + return false; + } if (locales.size) { - const locale = filePath.replace(root, "").split(path.sep)[1]; if (!locales.get(locale)) { return false; } diff --git a/content/translations.js b/content/translations.js index f52ee4d0a65c..8ff07ebae0bf 100644 --- a/content/translations.js +++ b/content/translations.js @@ -15,6 +15,9 @@ function gatherTranslations() { for (const { metadata: { slug, locale, title }, } of iter) { + if (!slug || !locale || !title) { + continue; + } const translation = { title, locale,