How do you guys typically get the readingTime string for content collections if you follow this astro guide? https://docs.astro.build/en/recipes/reading-time/
I could only come up with this (when I want the value outside of the page itself).
const postsCollection = await getCollection("blog");
const posts = await Promise.all(
postsCollection
.sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf())
.map(async (post) => {
const { remarkPluginFrontmatter } = await post.render();
return {
...post,
data: {
...post.data,
readingTime: remarkPluginFrontmatter.minutesRead as string,
},
};
}),
);
Is this solution ok? it seems pretty jank but it works.
