diff --git a/CHANGELOG.md b/CHANGELOG.md index d5648e8..e513069 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Bugfix ensuring aliases value is array when treated as one + ## [1.0.5] - Change to use `url` instead of `inputPath` for unique page key, this is because some pages can share the same `inputPath` such as those generated via pagination. diff --git a/index.js b/index.js index af94684..b04fa5d 100644 --- a/index.js +++ b/index.js @@ -144,7 +144,7 @@ module.exports = function (eleventyConfig, options = {}) { const found = (page.fileSlug === link.slug || (page.data.title && opts.slugifyFn(page.data.title) === link.slug)); if (found) return true; - const aliases = (page.data.aliases ?? []).reduce(function(set, alias){ + const aliases = ((page.data.aliases && Array.isArray(page.data.aliases)) ? page.data.aliases : []).reduce(function(set, alias){ set.add(opts.slugifyFn(alias)); return set; }, new Set());