fix: RSS feed includes full post content instead of summary only
- Extract body content from rendered HTML for feed descriptions - Feed readers will now see full post content, not just front-matter summary
This commit is contained in:
1 parent
06a50db987
commit
334fa146c7
1 file changed
+13
-1
@@ -165,12 +165,24 @@ function feedPlugin() {
|
||||
|
||||
posts.forEach((post) => {
|
||||
const postUrl = `https://marcusnoble.co.uk/${post.path}/`;
|
||||
|
||||
// Find the rendered HTML content for this post
|
||||
// post.path is the permalink path (e.g., 2026-03-17-kubecon-...), files use /index.html
|
||||
const contentKey = post.path + '/index.html';
|
||||
let renderedContent = "";
|
||||
if (files[contentKey]) {
|
||||
const fullHtml = files[contentKey].contents.toString();
|
||||
// Extract body content (match what metalsmith-feed did)
|
||||
const bodyMatch = fullHtml.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
||||
renderedContent = bodyMatch ? bodyMatch[1].trim() : fullHtml;
|
||||
}
|
||||
|
||||
feed.item({
|
||||
title: post.title,
|
||||
url: postUrl,
|
||||
guid: postUrl,
|
||||
date: post.date.toISOString(),
|
||||
description: post.summary || "",
|
||||
description: renderedContent || post.summary || "",
|
||||
categories: (post.tags || "").split(" ").filter(Boolean),
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user