Skip to content

Commit

Permalink
Merge pull request #17 from photogabble/patch/issue-16-array-check
Browse files Browse the repository at this point in the history
BUGFIX: Add isArray check before treating as array
  • Loading branch information
carbontwelve authored Apr 29, 2024
2 parents 8067b11 + d16bb16 commit f320312
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit f320312

Please sign in to comment.