Join the Webstudio community

Updated 5 months ago

Working with nested collections

At a glance

The community member is working on a website sitemap for a French real estate website, and they want to "divide" the sitemap by the type of rent (apartments, studios, houses) to optimize the crawling budget for Google. They have a structure in mind with nested collections (Departments, Cities, Ads), but they are struggling to get the value of the current collection item to reuse it in the second collection to filter the GET based on the department.

The community members discuss that resources cannot depend on data from other resources, and this would create a data fetching waterfall. They suggest embedding the array as a variable and using it in the collection, or creating a backend to handle the data fetching and keeping the Webstudio simple with a single fetch.

The community member decides to export the list of static things (Departments, Cities) manually and add them in JSON, and then only fetch the ads, which seems to be the recommended approach based on the discussion.

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