fix: add feed GUIDs and match production URL format

- Add <guid> elements to RSS feed (matching <link> URLs)
- Preserve dots in slugs (t.i.l. instead of til) to match production
- URLs now match production format: /YYYY-MM-DD-title-slug/
  No /posts/ prefix, with dots preserved for T.I.L. posts
- This ensures feed readers won't mark posts as new
This commit is contained in:
Marcus Noble committed 2026-11-16 13:35:16 +00:00
1 parent 63a171aefd
commit 06a50db987
1 file changed
+8 -7
+8 -7
View File
@@ -164,9 +164,11 @@ function feedPlugin() {
}); });
posts.forEach((post) => { posts.forEach((post) => {
const postUrl = `https://marcusnoble.co.uk/${post.path}/`;
feed.item({ feed.item({
title: post.title, title: post.title,
url: `https://marcusnoble.co.uk/${post.path}/`, url: postUrl,
guid: postUrl,
date: post.date.toISOString(), date: post.date.toISOString(),
description: post.summary || "", description: post.summary || "",
categories: (post.tags || "").split(" ").filter(Boolean), categories: (post.tags || "").split(" ").filter(Boolean),
@@ -436,15 +438,14 @@ const ms = Metalsmith(__dirname)
const d = value; const d = value;
return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0"); 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(/\/+$/, ""); .replace(/\/+$/, "");
// Add directory index // Add directory index - force index.html for permalinks without .html extension
if (path.extname(result) === "" || path.extname(result) === ".html") { // Dots in titles (like T.I.L.) confuse path.extname() so we check the actual extension
if (!path.extname(result)) { if (!result.endsWith(".html")) {
result = path.join(result, "index.html"); result = path.join(result, "index.html");
}
} }
// Post files: no prefix - URLs match production format /YYYY-MM-DD-slug/ // Post files: no prefix - URLs match production format /YYYY-MM-DD-slug/