, etc.) and then creating a hierarchical structure by referencing them together under a singleton document . I've looked at the docs about connected content , but I'm still trying to figure out how to use references for this particular use case. Thanks!
Feb 10, 2022, 10:16 PM
Hey User! You could handle this through reference fields. For example, a city would reference a state which would then reference a country. You can then use GROQ on your frontend to dynamically build out the paths. Alternatively, you could use the method I described in this thread to build out the slugs in your document.
Feb 10, 2022, 10:54 PM
Thanks, User! This looks great! Quick question, are there any pros or cons between referencing from bottom to top (
etc.) vs. top to bottom (
and so on)?
Feb 11, 2022, 12:07 AM
References are bi-directional when you query them so, in that sense, it doesn't matter where you place it. However when it comes to the Studio UI, you'll only see the reference field in the document where you set the reference. To clarify: if you set a reference to a country in a city document, the city document would show that relationship not the country document. I'd say place it wherever will be most intuitive for your editors to look for it. Does that make sense?
Feb 11, 2022, 12:16 AM
Ahhh, I see. Thanks for clarifying. That makes sense. I guess this goes back to how User described how the bi-directional querying works. I think I know what to do now. Thanks again!