diff --git a/.eleventy.js b/.eleventy.js index 06abc55e..b67a3b01 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -8,7 +8,6 @@ import markdownItFootnote from 'markdown-it-footnote' import htmlmin from 'html-minifier-terser' import filters from './config/filters/index.js' -import { slugifyString } from './config/utils/index.js' import { minifyJsComponents } from './config/events/index.js' import { searchIndex, tagList, tagsSortedByCount, links, tagMap, booksToRead } from './config/collections/index.js' import { DateTime } from 'luxon' @@ -97,10 +96,10 @@ export default async function (eleventyConfig) { if (!content) return return md.render(content) }) + Object.keys(filters).forEach((filterName) => { eleventyConfig.addLiquidFilter(filterName, filters[filterName]) }) - eleventyConfig.addFilter('slugify', slugifyString) // shortcodes eleventyConfig.addShortcode('appVersion', () => appVersion) diff --git a/config/filters/index.js b/config/filters/index.js index 64cdf708..36246bc5 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -1,6 +1,7 @@ import { DateTime } from 'luxon' -import markdownIt from 'markdown-it' import { URL } from 'url' +import slugify from 'slugify' +import markdownIt from 'markdown-it' import sanitizeHtml from 'sanitize-html'; import authors from '../data/author-map.js' @@ -23,6 +24,13 @@ export default { return string.replace(utmPattern, '') }, replaceQuotes: (string) => string.replace(/"/g, "'"), + slugifyString: (str) => { + return slugify(str, { + replacement: '-', + remove: /[#,&,+()$~%.'":*?<>{}]/g, + lower: true, + }) + }, // navigation isLinkActive: (category, page) => { @@ -45,7 +53,6 @@ export default { return visitors(b) - visitors(a) }) }, - tagLookup: (url, tagMap) => { if (!url) return if (url.includes('openlibrary.org')) return `#Books #NowReading ${tagMap[url]}`.trim() diff --git a/config/utils/index.js b/config/utils/index.js deleted file mode 100644 index a7b455f5..00000000 --- a/config/utils/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import slugify from 'slugify' - -export const slugifyString = (str) => { - return slugify(str, { - replacement: '-', - remove: /[#,&,+()$~%.'":*?<>{}]/g, - lower: true, - }) -} diff --git a/package-lock.json b/package-lock.json index a353d738..ff94c02e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "13.7.1", + "version": "13.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "13.7.1", + "version": "13.7.2", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.2.2", diff --git a/package.json b/package.json index 451f53c2..8ea1e258 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "13.7.1", + "version": "13.7.2", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/_includes/base.liquid b/src/_includes/base.liquid index cc566d00..2f9b60a9 100644 --- a/src/_includes/base.liquid +++ b/src/_includes/base.liquid @@ -25,7 +25,7 @@