mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-04-19 08:19:15 +00:00
feat(11ty): add defined definitions collection
This commit is contained in:
parent
04e14ae241
commit
76b3e13991
12
.eleventy.js
12
.eleventy.js
@ -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).
|
||||
return {
|
||||
dir: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user