make external links safer

This commit is contained in:
maia arson crimew 2023-05-19 14:12:14 +02:00
parent 6d24919a87
commit 5a0601e532
3 changed files with 125 additions and 1 deletions

View file

@ -1,6 +1,7 @@
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight') const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const pluginRss = require('@11ty/eleventy-plugin-rss'); const pluginRss = require('@11ty/eleventy-plugin-rss');
const timeToRead = require('eleventy-plugin-time-to-read'); const timeToRead = require('eleventy-plugin-time-to-read');
const safeLinks = require('@sardine/eleventy-plugin-external-links');
module.exports = function (eleventyConfig) { module.exports = function (eleventyConfig) {
const parseDate = (str) => { const parseDate = (str) => {
@ -16,6 +17,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(syntaxHighlight); eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(timeToRead); eleventyConfig.addPlugin(timeToRead);
eleventyConfig.addPlugin(safeLinks);
eleventyConfig.addPassthroughCopy({ "src/static": "/" }); eleventyConfig.addPassthroughCopy({ "src/static": "/" });

121
package-lock.json generated
View file

@ -11,6 +11,7 @@
"@11ty/eleventy": "^v2.0.0-beta.1", "@11ty/eleventy": "^v2.0.0-beta.1",
"@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
"@sardine/eleventy-plugin-external-links": "^1.4.0",
"eleventy-plugin-time-to-read": "^1.3.0" "eleventy-plugin-time-to-read": "^1.3.0"
} }
}, },
@ -233,6 +234,126 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@sardine/eleventy-plugin-external-links": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@sardine/eleventy-plugin-external-links/-/eleventy-plugin-external-links-1.4.0.tgz",
"integrity": "sha512-K9WDFQwLMSBo6bjqNmH3kZSdXKTAb0MYHK3Tmm8IChsprF1XHl574U4pxgouTwJNjzlxqPKI/JYbY2okg0tiaQ==",
"dependencies": {
"linkedom": "^0.13.0"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/css-select": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz",
"integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==",
"dependencies": {
"boolbase": "^1.0.0",
"css-what": "^6.0.1",
"domhandler": "^4.3.1",
"domutils": "^2.8.0",
"nth-check": "^2.0.1"
},
"funding": {
"url": "https://github.com/sponsors/fb55"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/dom-serializer": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz",
"integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==",
"dependencies": {
"domelementtype": "^2.0.1",
"domhandler": "^4.2.0",
"entities": "^2.0.0"
},
"funding": {
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/domhandler": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz",
"integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==",
"dependencies": {
"domelementtype": "^2.2.0"
},
"engines": {
"node": ">= 4"
},
"funding": {
"url": "https://github.com/fb55/domhandler?sponsor=1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/domutils": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
"integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
"dependencies": {
"dom-serializer": "^1.0.1",
"domelementtype": "^2.2.0",
"domhandler": "^4.2.0"
},
"funding": {
"url": "https://github.com/fb55/domutils?sponsor=1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/entities": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/htmlparser2": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz",
"integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==",
"funding": [
"https://github.com/fb55/htmlparser2?sponsor=1",
{
"type": "github",
"url": "https://github.com/sponsors/fb55"
}
],
"dependencies": {
"domelementtype": "^2.0.1",
"domhandler": "^4.2.2",
"domutils": "^2.8.0",
"entities": "^3.0.1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/htmlparser2/node_modules/entities": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/linkedom": {
"version": "0.13.7",
"resolved": "https://registry.npmjs.org/linkedom/-/linkedom-0.13.7.tgz",
"integrity": "sha512-We9cyPHV/exsrC43KXtItjqSTxwrK9pLpOnG6TLzqXrmqwe/wqd3Gi6eAAU4YCqfTgy79R8g75hY2fS7723XUg==",
"dependencies": {
"css-select": "^4.2.1",
"cssom": "^0.5.0",
"html-escaper": "^3.0.3",
"htmlparser2": "^7.2.0",
"uhyphen": "^0.1.0"
}
},
"node_modules/@sardine/eleventy-plugin-external-links/node_modules/uhyphen": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.1.0.tgz",
"integrity": "sha512-o0QVGuFg24FK765Qdd5kk0zU/U4dEsCtN/GSiwNI9i8xsSVtjIAOdTaVhLwZ1nrbWxFVMxNDDl+9fednsOMsBw=="
},
"node_modules/@sindresorhus/slugify": { "node_modules/@sindresorhus/slugify": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-1.1.2.tgz",

View file

@ -11,6 +11,7 @@
"@11ty/eleventy": "^v2.0.0-beta.1", "@11ty/eleventy": "^v2.0.0-beta.1",
"@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
"@sardine/eleventy-plugin-external-links": "^1.4.0",
"eleventy-plugin-time-to-read": "^1.3.0" "eleventy-plugin-time-to-read": "^1.3.0"
} }
} }