Querying categories and posts in Sanity.io using GROQ
Last updated: Jun 10, 2021
Hi! First project w/ Sanity and since it seemed easiest (because it was the example in the tutorial 🤷♀️) and I thought I could modify it later I chose Blog as a template.I'm doing a site where I'm going to display different categories of handicrafts - with name/title and an image (used Post to set up this). I've added all the different categories in Category and connected each post to the correct category. My question is, is it possible to query on category, and how do I do that?
Jun 10, 2021, 8:42 AM
What exactly do you want to do? Do you want to get all categories and their posts? In GROQ that would be this query