I’ve got a search page where users can filter the results (externally via Xano) and due to the nature of the results (price comparison) the page is using a dynamic collection. When the user clicks on a product, I then take them to a static collection page of that item.
Since there is no native way to link from a dynamic collection to a static collection, I used the “Url” link type on the dynamic collection to essentially concatenate a URL together that takes the user to the static page.
The problem? When the user is done looking at that product page and wants to go back to their search results by clicking “Back” in the browser, all of the filters & adjustments they made are gone and they have to start over. Not a great user experience.
What appears to be happening is if a user navigates through that type of link (URL) WeWeb seems to be clearing all of the variables. I’m guessing this is because WeWeb thinks it’s an external link, even though it goes to the same domain it’s been on.
Unless there is a more effective way to link to the static product pages from my dynamic collection, it seems there are only two solutions to this:
Save those variables to local storage (instead of using the “Preserve on Navigation” feature). It’s not as ideal, as the user could potentially return to the site expecting a fresh search.
Open those links in a new tab. I believe this will keep the variables alive (since the user is still technically on the page) but I fear this would not be as ideal from a user experience (imagine if on Amazon every product you clicked on opened in a new tab).
But can somebody verify this is indeed the case before I make these changes?
Hi, you have a way to link a static collection page
If you’re in an iteration context, like you seem to be on your list, you can select your static collection and it will figure out the route by itself.
To clarify, are you saying it’s possible to link from a dynamic collection to a static collection? I tried your method but it doesn’t seem to work. If I connect it exactly like your screenshot shows, the products do hyperlink to a static page but the product shown is incorrect. I also tried setting the “Link to” to a Collection page as you have in your screenshot, but then binding the “Page” field to the corresponding slug field that should match the static field but didn’t have any luck with that either.
You don’t have to bind the slug, what happen if you just select the static page without binding anything ?
Some magic should happen under the hood, if your link to a static page is set on the right element. The only thing bound here is the collection list, every child inside benefit from the “auto link” if you set the link to the same collection page you’re iterating on your UI
When I don’t bind anything and just set it to go to the static collection page, some magic is definitely happening in the background, but the wrong rabbit keeps getting pulled out of the hat. Perhaps it’s likely that the two fields it’s trying to match aren’t the same.
For context, here is the item data that my dynamic collection is returning:
Both collections have overlap in the values they return. For example, both have the same “id” field/value and both have the same “slug” field/value. The “slug” value is what I use as the binding field on the static collection page URL:
Ah yes, its because you’re using two distinct collection, the matching is based on the index because of a legacy behavior.
Your item has probably a different position depending of the collection, so the item n in your dynamic collection is not the same as the item n in your static collection.
And yes, you correctly guessed the issue, using the link mode perform an external navigation, it doesn’t use the internal router so its like you’re moving to another website and lose internal states.
The workaround I can see for you right now would be to use a custom JS action instead. Where you can call the wwLib.goTo method. But it will work only on your published website.
wwLib.goTo(context.item.data?.['slug'])
Feel free to open a feature request on feedback.weweb.io so we can improve the link system, allowing you to navigate to a specific static page by giving the slug or custom calculated index for example.