fix: correct alternate link URL for markdown-agents

Add stripTrailingSlash filter and use it in the link tag so the
alternate URL is /articles/.../slug.md (matching nginx routing)
instead of /articles/.../slug/index.md.
This commit is contained in:
Ricardo
2026-02-24 20:53:04 +01:00
parent 4c2828f6fe
commit 338bd3cc64
+5
View File
@@ -412,6 +412,11 @@ export default function (eleventyConfig) {
.replace(/^-+|-+$/g, ""); .replace(/^-+|-+$/g, "");
}); });
eleventyConfig.addFilter("stripTrailingSlash", (url) => {
if (!url || typeof url !== "string") return url || "";
return url.endsWith("/") ? url.slice(0, -1) : url;
});
// Hash filter for cache busting - generates MD5 hash of file content // Hash filter for cache busting - generates MD5 hash of file content
eleventyConfig.addFilter("hash", (filePath) => { eleventyConfig.addFilter("hash", (filePath) => {
try { try {