sanity-io / sanity-algolia

Utilities for indexing Sanity documents in Algolia
MIT License
67 stars 16 forks source link

Access reference content #1

Closed andrevenancio closed 3 years ago

andrevenancio commented 3 years ago

A pretty common case I find in a blog is to categorise it with "tags" or "categories". Lets take "tags" as an example:

If your blog post is about front-end development you might use tags like "html", "css", "javascript". Because the tags are references attached to the post, when you receive them via https://PROJECT_ID.api.sanity.io/v1/data/export/DATASET you can't easily access their slug via the post because they're just a reference. So you will need to check for that reference manually.

In this example we're doing it using streams which to me is harder to grasp how to access reference data that isn't coming directly associated with the post.

So I wonder how could we do it without saving it in memory and looping data over and over to find the data.

In other words I need to get slug and title from my tags schema, but the tags get saved as a reference in the post. Hope this is clear.

runeb commented 3 years ago

Duplicate with #4