feat: add eleventy-plugin-footnotes for accessible footnotes

Registers the KittyGiraudel footnotes plugin and adds {% footnotes %}
to post.njk below the article content.

Usage in content:
  {% footnoteref "id" "Footnote text here" %}anchor text{% endfootnoteref %}

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-23 19:08:01 +01:00
parent 42962fad60
commit 5354b3349d
4 changed files with 28 additions and 0 deletions

View File

@@ -100,6 +100,9 @@ withBlogSidebar: true
{# Rich reply context with h-cite microformat #}
{% include "components/reply-context.njk" %}
{# Footnotes collected from {% footnoteref %} shortcodes in the content #}
{% footnotes %}
{# AI usage disclosure — articles and notes only #}
{% if '/articles/' in page.url or '/notes/' in page.url %}
<details class="mt-4 text-xs text-surface-700 dark:text-surface-300">

View File

@@ -20,6 +20,7 @@ import { fileURLToPath } from "url";
const esmRequire = createRequire(import.meta.url);
const postGraph = esmRequire("@rknightuk/eleventy-plugin-post-graph");
const pluginFootnotes = esmRequire("eleventy-plugin-footnotes");
const __dirname = dirname(fileURLToPath(import.meta.url));
const siteUrl = process.env.SITE_URL || "https://example.com";
@@ -154,6 +155,10 @@ export default function (eleventyConfig) {
// Mermaid diagram support — renders ```mermaid code blocks as diagrams
eleventyConfig.addPlugin(pluginMermaid);
// Accessible footnotes — {% footnoteref "id" "note text" %}…{% endfootnoteref %}
// Render collected footnotes with {% footnotes %} in the post layout.
eleventyConfig.addPlugin(pluginFootnotes);
// Post graph — GitHub-style contribution grid for posting frequency
eleventyConfig.addPlugin(postGraph, {
sort: "desc",

19
package-lock.json generated
View File

@@ -27,6 +27,7 @@
"@zachleat/table-saw": "^1.0.7",
"alpinejs": "^3.15.8",
"eleventy-plugin-embed-everything": "^1.21.0",
"eleventy-plugin-footnotes": "^0.11.0",
"gray-matter": "^4.0.3",
"html-minifier-terser": "^7.0.0",
"lite-youtube-embed": "^0.3.2",
@@ -2317,6 +2318,15 @@
"node": ">=12"
}
},
"node_modules/clsx": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
"integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/color": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
@@ -2841,6 +2851,15 @@
"url": "https://opencollective.com/11ty"
}
},
"node_modules/eleventy-plugin-footnotes": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/eleventy-plugin-footnotes/-/eleventy-plugin-footnotes-0.11.0.tgz",
"integrity": "sha512-NQd6jNPekxIhESIIWPKUv2XXoYYknfDG8KjCdftSMGquncu1u9StVIDPmBinPChl4l68d8qTgmMXyM7kRxwGsg==",
"license": "MIT",
"dependencies": {
"clsx": "^1.1.1"
}
},
"node_modules/eleventy-plugin-vimeo-embed": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/eleventy-plugin-vimeo-embed/-/eleventy-plugin-vimeo-embed-1.4.0.tgz",

View File

@@ -30,6 +30,7 @@
"@zachleat/table-saw": "^1.0.7",
"alpinejs": "^3.15.8",
"eleventy-plugin-embed-everything": "^1.21.0",
"eleventy-plugin-footnotes": "^0.11.0",
"gray-matter": "^4.0.3",
"html-minifier-terser": "^7.0.0",
"lite-youtube-embed": "^0.3.2",