diff --git a/.eleventy.js b/.eleventy.js index 91f37979..3bb4af2c 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,10 +1,22 @@ +const makeItemLink = (slug) => `#${slug}` + module.exports = function (config) { // Add a filter using the Config API - config.addFilter('linkTarget', (slug) => `#${slug}`); + config.addFilter('linkTarget', makeItemLink); + config.addFilter('linkIfExistsInCollection', (word, collection) => { + const existingDefintion = collection.find(item => item.data.title === word) + + if (existingDefintion) { + return `${word}` + } + + return word + }) + + // just a debug filter to lazily inspect the content of anything in a template config.addFilter('postInspect', function (post) { console.log(post); - }) config.addPassthroughCopy({'_site/css/': 'assets/css/'}) diff --git a/11ty/_includes/components/definition.njk b/11ty/_includes/components/definition.njk index b02c14e7..a2ce3639 100644 --- a/11ty/_includes/components/definition.njk +++ b/11ty/_includes/components/definition.njk @@ -10,7 +10,7 @@