diff --git a/.eleventy.js b/.eleventy.js
index cb77b44a..a17857a0 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -1,15 +1,15 @@
-const makeItemLink = (slug) => `#${slug}`;
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition');
+const definitionPermalink = require('./11ty/filters/definitionPermalink');
module.exports = function(config) {
// Add a filter using the Config API
- config.addFilter('linkTarget', makeItemLink);
+ config.addFilter('linkTarget', definitionPermalink);
config.addFilter('linkIfExistsInCollection', (word, collection) => {
const existingDefinition = findExistingDefinition(word, collection);
if (existingDefinition) {
- return `${word}`;
}
@@ -24,7 +24,7 @@ module.exports = function(config) {
);
if (existingDefinition) {
- return `${subTermData.text}`;
}
diff --git a/11ty/filters/_tests/definitionPermalink.spec.js b/11ty/filters/_tests/definitionPermalink.spec.js
new file mode 100644
index 00000000..8a971b3a
--- /dev/null
+++ b/11ty/filters/_tests/definitionPermalink.spec.js
@@ -0,0 +1,7 @@
+import test from 'ava';
+
+import definitionPermalink from '../definitionPermalink';
+
+test('constructs correct detail link', (t) => {
+ t.is(definitionPermalink('test-slug'), '/definitions/test-slug/');
+});
diff --git a/11ty/filters/definitionPermalink.js b/11ty/filters/definitionPermalink.js
new file mode 100644
index 00000000..b9d05ee7
--- /dev/null
+++ b/11ty/filters/definitionPermalink.js
@@ -0,0 +1,3 @@
+module.exports = function(slug) {
+ return `/definitions/${slug}/`;
+};