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:
1 parent
63a171aefd
commit
06a50db987
1 file changed
+8
-7
@@ -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/
|
||||
|
||||
Reference in new issue
Block a user