permalinks icon indicating copy to clipboard operation
permalinks copied to clipboard

unique option output (both default & custom) are hard to control.

Open webketje opened this issue 3 years ago • 0 comments

Describe the bug unique option is hard to control and doesn't work as intended: The order in which the files are passed to the unique function depends on the filesystem -> object keys order (usually alphabetic). See https://github.com/metalsmith/permalinks/runs/2698927437. Currently this makes test runs unpredictable.

Additional context Suppose a directory with 3 files: a.html, b.html, c.html, all with the title "test". b.html was added before a.html, so logically we would want b.html to be renamed to test/index.html and a.html to test-1/index.html. Unfortunately this fails. A better metric to choose which filepath to transform would be stats.mtime (for default makeUnique function).

Indicates that this option has rarely been put to use. Due to the structure of the plugin fixing this issue would require a major refactor.

webketje avatar May 29 '21 01:05 webketje