1const fs = require("fs");
2const path = require("path");
3const matter = require("gray-matter");
4const toml = require("@iarna/toml");
5const Feed = require("feed").Feed;
9 toml: toml.parse.bind(toml),
15const generateRSSFeed = () => {
18 const getAllChildren = (dir) => {
19 const children = fs.readdirSync(dir, { withFileTypes: true });
21 .filter((f) => f.isFile() && f.name !== "_index.md")
23 const { data: pageData, content: pageContent } = matter(
24 fs.readFileSync(path.join(dir, post.name)),
28 title: pageData.title,
29 descripton: pageData.description || "",
30 author: pageData.extra.author || "",
34 dir.substr(dir.indexOf("content") + 7),
36 post.name.replace(/.md$/, "")
43 ...getAllChildren(path.join(process.cwd(), "content/blog")),
44 ...getAllChildren(path.join(process.cwd(), "content/updates")),
45 ...getAllChildren(path.join(process.cwd(), "content/events"))
47 posts = posts.sort((a, b) => (a.date > b.date ? -1 : 1));
49 const baseUrl = "https://urbit.org";
52 email: "support@urbit.org",
53 link: "https://urbit.org",
56 // Construct a new Feed object
57 const feed = new Feed({
59 description: "Urbit is a personal server built from scratch",
64 rss2: `${baseUrl}/rss.xml`,
69 // Add each article to the feed
70 posts.forEach((post) => {
71 const { title, description, author, date, link, content } = post;
89 fs.readdirSync("public");
91 fs.mkdirSync("public");
94 fs.writeFileSync("public/rss.xml", feed.rss2());
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list