You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

import rss from "@astrojs/rss";
/* function sortWithTransform(array, transform, sorter) {
console.log(array)
global.JANK_newArray = []
Promise.all(array.map(async (i) => { return await transform(i) })).then(
(res)=>{
res.forEach(i => {
global.JANK_newArray.push(i)
})
}
)
console.log(global.JANK_newArray)
return array
}
/*const sortObject = obj => Object.keys(obj).sort(async (a,b)=> {
console.log(await obj[b]())
return (new Date((await obj[b]()).frontmatter.pubDate)) - (new Date((await obj[a]()).frontmatter.pubDate))
}).reduce((res, key) => (res[key] = obj[key], res), {}); * /
const sortObject = obj => sortWithTransform(Object.keys(obj), async (o) => {
return new Date((await obj[o]()).frontmatter.pubDate)
}, (a,b) => b-a).reduce((res, key) => (res[key] = obj[key], res), {}); */
let posts = import.meta.glob("./*.md*");
Object.keys(posts).forEach(async (k) => {
const res = await posts[k]();
if (res.frontmatter.wip) {
delete posts[k];
}
}) //remove WIP entries
export const get = () => rss({
title: "Ruthenic's blog",
description: "My blog, utilized for talking about random things.",
site: import.meta.env.SITE,
items: posts,
stylesheet: "/rssStyle.xsl"
})