#Is it possible to use get all pages like `getCollection` in `getStaticPaths`?

2 messages · Page 1 of 1 (latest)

dense quiver
#

Yesterday I added opengraph images to my site using Vercel's @vercel/og package. I wanted to create an OG image for all blog posts as well as all other pages. The blog posts are all in a content collection but the other pages are a mix of .astro and .md pages.

It was trivial to get all info about the blog posts by using Astro's getCollection() function but I couldn't find a way to automatically get the other pages. Is there a way to do that?

I solved the issue by creating a dictionary for all the other pages and merging that with the data from getCollection() but I was hoping for a better way...

FYI you can see my code here: https://github.com/mrmartineau/zander.wtf/blob/main/src/pages/opengraph/[slug]/og.png.ts#L179-L191

GitHub

my site. Contribute to mrmartineau/zander.wtf development by creating an account on GitHub.

pale lion