Join the Webstudio community

Updated 2 months ago

Working with nested collections

At a glance
Hey guys !

I'm working on my website sitemap, and I'm facing a few difficulties. My website is a french real estate website, and therefore I have a list of Regions, Department an Cities, along with a few types of rent (appartments, studios, houses...)

I'd like to "divide" my sitemap with the type of rent, to make it clearer for Google crawlers and optimize the crawling budget.

Therefore, I'm trying to do this tructure :

In my sitemap-appartement.xml page :

  • Collection --> Departement (a list of 101 departements)
    • Collection --> Cities (will be a few thousands per departements)
      • Collection --> Ads (i.e the pages of the flats for rent)
and then duplicate this page for the other sitemaps (location-studios, location-houses)

The call for the first collection is working fine, but I'm struggling to get the value of the Current collection item to reuse it in my second collection (to filter the GET based on the department)

Is there any way to do this ? Or is it a bit tricky to work with nested collections like this ? Would it be better to make it static ? (a bit of work since there are 40k+ cities in France)
O
T
13 comments
resources currently can't depend on data from other resources
also it would create a data fetching waterfall
Hmmm, so even if it was possible, not recommended ?
just corrected myself, resources is the problem not collections
if you embed the array as a variable and use it in the collection, it should work
resource has to fetch data first which you are trying to wait on and then use the result to fetch something else if I understand correctly
Okay, that was the plan B I had in mind.

Export the list of static things (Dept, Cities), add them in JSON Manually, and then only fetch the ads
alternative is - create your own backend, decide how you fetch things there, keep things in webstudio simple in one fetch
that's the default way of doing these things
webstudio is not a backend
Okay thanks for the input ! I'm going to do that πŸ™‚
Add a reply
Sign up and join the conversation on Discord