|
| 1 | +module.exports = function (config) { |
| 2 | + // Add a filter using the Config API |
| 3 | + config.addFilter('linkTarget', (slug) => `#${slug}`); |
| 4 | + |
| 5 | + config.addFilter('postInspect', function (post) { |
| 6 | + console.log(post); |
| 7 | + |
| 8 | + }) |
| 9 | + |
| 10 | + config.addPassthroughCopy({'_site/css/': 'assets/css/'}) |
| 11 | + |
| 12 | + // Add collections here |
| 13 | + config.addCollection('definitions', collection => { |
| 14 | + return [ |
| 15 | + ...collection |
| 16 | + .getFilteredByGlob('./11ty/definitions/*.md') |
| 17 | + .sort((a, b) => { |
| 18 | + // `toLowerCase()` is just a safety measure, slugs should be lower case anyway |
| 19 | + // `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare |
| 20 | + return a.data.slug.toLowerCase().localeCompare(b.data.slug.toLowerCase()) |
| 21 | + })] |
| 22 | + }) |
| 23 | + |
| 24 | + config.addCollection('definedDefinitions', collection => { |
| 25 | + return [ |
| 26 | + ...collection |
| 27 | + .getFilteredByGlob('./11ty/definitions/*.md') |
| 28 | + .filter(word => word.data.defined) |
| 29 | + .sort((a, b) => { |
| 30 | + // `toLowerCase()` is just a safety measure, slugs should be lower case anyway |
| 31 | + // `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare |
| 32 | + return a.data.slug.toLowerCase().localeCompare(b.data.slug.toLowerCase()) |
| 33 | + })] |
| 34 | + }) |
| 35 | + |
| 36 | + // You can return your Config object (optional). |
| 37 | + return { |
| 38 | + dir: { |
| 39 | + input: '11ty', |
| 40 | + output: 'dist' |
| 41 | + }, |
| 42 | + templateFormats: ['njk', 'md'], |
| 43 | + htmlTemplateEngine: 'njk', |
| 44 | + markdownTemplateEngine: 'njk', |
| 45 | + passthroughFileCopy: true |
| 46 | + }; |
| 47 | +}; |
0 commit comments