metalsmith / permalinks

A Metalsmith plugin for permalinks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

options unique & duplicatesFail overlap in functionality

webketje opened this issue · comments

The (way too complicated) matrix is:

  1. unique: false && duplicatesFail: false = overwrites dupes
  2. unique: false && duplicatesFail: true = throws
  3. unique: true && duplicatesFail: false = dedupes
  4. unique: true && duplicatesFail: true = throws (??)
  5. unique: function && duplicatesFail: false
  6. unique: function && duplicatesFail: true

Combo 1 is bad because having 2 files with the same target destination is not a good idea and much more likely to be unintentional. In 99% of cases permalinks should flag such an issue by throwing.

Combo 2 doesn't make sense: we first instruct permalinks to overwrite dupes, but then instruct it to throw when dupes are encountered

Combo 4 doesn't make sense: the current impl throws, but I would expect it to never throw as a postfix is added to each file. Then again I would also not expect to be able to specify duplicatesFail because it makes no sense in this context.

Conclusion

These options need to be bundled into 1 option duplicates: 'error'|'overwrite'|'index'|custom func. The default is 'error'