treefarmstudio / astro-sanity-minimal-starter

https://astro-sanity-minimal-starter.netlify.app/
MIT License
105 stars 14 forks source link

Issues not displaying author and category #8

Closed zeshhaan closed 2 years ago

zeshhaan commented 2 years ago

The groq query for allPosts doesn't fetch current category title and slug. Also it doesn't fetch author name.

Here is how it looks now

export const allPosts = `*[_type == 'post']{categories[]->{slug, title}, ...} | order(publishedAt desc)`;

Here is the fix that worked for me

export const allPosts = `*[_type == 'post']{..., categories[]->{title, slug}, author -> {name}} | order(publishedAt desc)`;

Thanks

jaydanurwin commented 2 years ago

Thanks for filing this issue @zeshhaan! It should be fixed in the next branch already and will be merged in with #12 after Astro releases their official v1.0 version which (hopefully) is very soon.