feat(11ty): add defined definitions collection

This commit is contained in:
Oscar 2019-11-12 01:17:21 +01:00
parent 04e14ae241
commit 76b3e13991

View File

@ -14,6 +14,18 @@ module.exports = function (config) {
})] })]
}) })
config.addCollection('definedDefinitions', collection => {
return [
...collection
.getFilteredByGlob('./11ty/definitions/*.md')
.filter(word => word.data.defined)
.sort((a, b) => {
// `toLowerCase()` is just a safety measure, slugs should be lower case anyway
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
return a.data.slug.toLowerCase().localeCompare(b.data.slug.toLowerCase())
})]
})
// You can return your Config object (optional). // You can return your Config object (optional).
return { return {
dir: { dir: {