diff --git a/app.js b/app.js index 00854c8..45967c7 100644 --- a/app.js +++ b/app.js @@ -164,9 +164,11 @@ function feedPlugin() { }); posts.forEach((post) => { + const postUrl = `https://marcusnoble.co.uk/${post.path}/`; feed.item({ title: post.title, - url: `https://marcusnoble.co.uk/${post.path}/`, + url: postUrl, + guid: postUrl, date: post.date.toISOString(), description: post.summary || "", categories: (post.tags || "").split(" ").filter(Boolean), @@ -436,15 +438,14 @@ const ms = Metalsmith(__dirname) const d = value; return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0"); } - return String(value).toLowerCase().replace(/\s+/g, "-").replace(slugRe, "").replace(/-+/g, "-").replace(/\./g, ""); + return String(value).toLowerCase().replace(/\s+/g, "-").replace(slugRe, "").replace(/-+/g, "-"); }) .replace(/\/+$/, ""); - // Add directory index - if (path.extname(result) === "" || path.extname(result) === ".html") { - if (!path.extname(result)) { - result = path.join(result, "index.html"); - } + // Add directory index - force index.html for permalinks without .html extension + // Dots in titles (like T.I.L.) confuse path.extname() so we check the actual extension + if (!result.endsWith(".html")) { + result = path.join(result, "index.html"); } // Post files: no prefix - URLs match production format /YYYY-MM-DD-slug/