Fix RSS feed sorting and custom updated data
This commit is contained in:
@@ -3,7 +3,11 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
|
||||
|
||||
let posts = Object.values(import.meta.glob("../posts/*.md", { eager: true }));
|
||||
|
||||
console.log(posts);
|
||||
posts = posts.sort(
|
||||
(a, b) =>
|
||||
new Date(b.frontmatter.updated || b.frontmatter.added).valueOf() -
|
||||
new Date(a.frontmatter.updated || a.frontmatter.added).valueOf()
|
||||
);
|
||||
|
||||
export const get = () =>
|
||||
rss({
|
||||
@@ -17,9 +21,9 @@ export const get = () =>
|
||||
pubDate: post.frontmatter.added,
|
||||
description: post.frontmatter.description,
|
||||
content: post.compiledContent(),
|
||||
customData: {
|
||||
updated: post.frontmatter?.updated,
|
||||
},
|
||||
customData: `<updated>${
|
||||
post.frontmatter.updated ? post.frontmatter.updated : ""
|
||||
}</updated>`,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user