metalsmith / permalinks

A Metalsmith plugin for permalinks.
MIT License
62 stars 67 forks source link

Replace momentjs with alternative #131

Closed webketje closed 11 months ago

webketje commented 2 years ago

Luxon looks good (also for multilang-localized dates especially) https://moment.github.io/luxon

webketje commented 1 year ago

Further thinking of this, given permalinks maps the date part to folder structures, there's only half or so of the formatting at the table at https://momentjs.com/docs/#/displaying/format/ that should be allowed. All the formats containing + or : or undesirable as they clash with either folder allowed chars or url-recognized chars.

99% of use cases will use either inverted ISO-like format 2022/01/01 or with some parts in full, eg archive/2022/january. Luxon unfortunately relies on the Intl API which is not guaranteed to be available in all Node builds (regardless of version). So the best way forward may be to provide our own limited set of formatting tokens (compatible with moment.js)