import { BlogPost } from "../models/blog.js";
export function generateRSS(domain: string, posts: BlogPost) {
const buildDate = new Date().toUTCString();
let feed: string =
`
xero's blog: the RSS feed
${domain}
xero's blog: programming, code, art, ascii, pixel, text art, ansi, lab, notes, graffiti, neovim, vim, linux, unix, nerd, bun.sh, htmx, tailwindcss, xero, x-e.ro, xxe.ro, 0w.nz, xero.style
${buildDate}
en-us
`
posts.forEach(post => {
let postDate = new Date(post.date * 1000).toUTCString();
let excerpt:string = post.excerpt.replaceAll('
${post.title}
${domain}/${post.url}
${domain}/${post.url}
${postDate}
`
});
Bun.write('dist/rss.xml', `${feed}
`);
}
export function generateAtom(domain: string, posts: BlogPost) {
const buildDate = new Date().toISOString();
let feed: string =
`
xero's blog: the atom feed
xero's blog: programming, code, art, ascii, pixel, text art, ansi, lab, notes, graffiti, neovim, vim, linux, unix, nerd, bun.sh, htmx, tailwindcss, xero, x-e.ro, xxe.ro, 0w.nz, xero.style
${buildDate}
xero harrison
${domain}/
`
posts.forEach(post => {
let postDate = new Date(post.date * 1000).toISOString();
let excerpt:string = post.excerpt.replaceAll('
${post.title}
${domain}/${post.url}
xero harrison
${postDate}`
post.meta.cats.forEach(cat => {
feed += ``
});
feed += `
`
});
Bun.write('dist/atom.xml', `${feed}
`);
}