Sanity – Approach to build archive page with queries similar to "Query Loop Block" in Wordpress?

26 views Asked by At

Working on a website built with Sanity and Next.js where the client want to be able to create curated archive pages, I'm struggling to come up with the best way to approach this. The editorial idea is to have a content type of type archive that allows to set some params such as category, content_type, date range and order. These params is then what Next.js should use to present the filtered result. Much like how you can build custom queries with WordPress' Query Loop Block.

The params should ideally not be shown in the URL.

As I see it, I should query archive, grab the values of the defined filter fields (params). These then can be used for an additional query where I get the data that I want as it doesn't seem to be possible to run a single query with dynamic values?

However, it's possible to achieve this with Documents Pane: enter image description here But as I understand, the result of that query cannot be 'saved' to be used in the front end.

Is there some other approach that makes more sense?

0

There are 0 answers