I have a router on my site, and I want to build its site map entries based on items from my DB collection.
The way I found for doing that is using wixData.query, then using map() on the results, and building a the site map entry there.
The problem is that because wixData.query() is a asyncronous function, the _SiteMap() function ends before the wixData.query() does. Now, I can try to make the code wait for it to finish (not sure how to do it, but I guess I can find out), but seeing as _SiteMap() doesn't just run once - that would really slow the site down.
So, any other ideas for implementing this that don't involve querying the database too often?