metalsmith / collections

A Metalsmith plugin that groups files together into collections, which it adds to the global metadata.
MIT License
105 stars 66 forks source link

Added 'newer' and 'older' references #83

Closed seinolab closed 12 months ago

seinolab commented 6 years ago

I propose new references 'newer' and 'older'. These references keep chronological order. In other words, they are free from 'reverse' setting.

Consider the following example. Some users need both of the latest and oldest ordered collections. In such case, 'previous' and 'next' references are broken because the references are overwritten, but 'newer' and 'older' work correctly.

metalsmith.use(collections({
  latest: {
    pattern: '*.md',
    sortBy: 'date',
    reverse: true
  },
  oldest: {
    pattern: '*.md',
    sortBy: 'date',
    reverse: false
  }
}));