-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: streamline RSS feed generation #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nd optimizing post handling
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…structuring URL handling
|
Normally, const postsWithUrls = sorted.map((post) => {
const contentPath = path.relative(process.cwd(), post.file);
let url = contentPath
.replace(/^src\/content/, "")
.replace(/\.md$/, "")
.replace(/index$/, "");
url = url.replace(/\\/g, "/");
if (!url.startsWith("/")) {
url = `/${url}`;
}
if (!url.startsWith("/posts/")) {
url = `/posts${url}`;
}
return {
...post,
url: url,
};
}); |
|
I think it's a relatively neat solution (just tweaked the official sample). |
|
https://fuwari-yags-git-482-rss-is-no-616003-zephyirdgmailcoms-projects.vercel.app/rss.xml This is an RSS feed of the latest Pull Request preview builds. It seems to work fine here, but... |
I tried on my debian server rebuild:root@iZuf69xtxkoed8503i71xwZ:~/fuwari# cat dist/rss.xml <title>Fuwari</title>Demo Sitehttps://fuwari.vercel.app/en<title>Markdown Extended Features</title>https://fuwari.vercel.app/posts/markdown-extended/It working! But on my windows:I tried clone again,but the same problem |
|
I forgot to handle the OS path. |
|
look at Markdown Example's rss
in rss readerin postMaybe we need to select and keep part of it |
|
Now, opening a Pull Request is one thing, but honestly, the code feels downright terrible. |





This pull request removes the
markdown-itdependency and its related packages, replacing its functionality with a custom implementation for processing blog posts in the RSS feed. The changes focus on dependency cleanup and code refactoring.Dependency Cleanup:
markdown-itdependency frompackage.jsonandpnpm-lock.yaml, along with associated packages likelinkify-it,mdurl,punycode.js, anduc.micro. These packages were no longer needed after the refactor. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Code Refactoring:
src/pages/rss.xml.tsto replace themarkdown-itparser with a new approach usingcompiledContent()for rendering post content. This also introduced a custom filtering and sorting mechanism for blog posts based on their metadata.