I would like to open the same page with an additional parameter in URL, so that users can share a URL with the parameter (which triggers action on this page) and not the generic page URL.
I use “Go to page”, but all it does — it appends the parameter to the URL. I need to then use the workflow action “refresh page” to actually make Bubble go to that page, which is OK with me, but Bubble gives me an error icon saying that “Go to page” should be the last item in a workflow. Silly Bubble or silly me?
When page is loaded without a parameter, it shows A. When it’s loaded with a parameter, it shows B. I am on a page showing A, and I click a button which appends a parameter. Parameter shows in the browser URL field, but nothing happens. I can’t use “When page is loaded”, since I appended the parameter after it’s been loaded.
See this example. By making use of conditionals, elements on the page can respond to changes in the query string without reloading the page - e.g. showing/hiding groups, changing element appearance, etc. Notice the address bar URL and the text fields on the page as the buttons are clicked.
Path params are another story though. AFAIK, without a plugin, the page will reload. That was one of several motivations behind Sudsy Page. Of course, in addition to better performance and UX, there are also SEO benefits to using link elements and clean URLs.
Hi there @sudsy. This is a great example, and I should make the use of it for sure! However, I once again failed to explain the purpose of my exercise.
Let me just show you on my app.
This is the link to the app page, which presents a gallery of advice guides. When you click on any advice, you switch to the preview mode. For example, click on the Dog’s toothache advice. Make a note that the URL hasn’t changed (it’s a one page app).
Now, paste this link to a new browser window. It will open the Dog’s advice in the viewer mode, but now you have the ID in the URL.
The point is — always have the corresponding advice id within the URL, so that when the user shares the page, he shares the URL to a specific advice, and not the app in general.
P.S. Apparently, it works fine with only “Go to page” and without refreshing (advice ID gets appended and correct URL can be copied). However, I don’t understand why Bubble made it this way so that pages with the same page name but various parameters are not considered as different pages, which is a case in web programming since like 20 years.
My understanding is that having the query string always appear in the URL for a specific advice is the desired behavior, right?
So it seems your question is, ”How do I get the advice-specific URL to appear in the address bar when the gallery image is clicked?“
The example I provided seems to demonstrate one way of doing that.
Since it’s not happening in your app when a gallery image is clicked, the issue comes down to how your navigation is being handled internally in that case.
If you can elaborate and/or share a screenshot of your workflow which handles the gallery image click, that would be helpful.
I don’t understand why you need to refresh the page. That should not be necessary. You should be able to display page content based on the changed URL - an approach that is used often in Bubble SPA’s.
It’s not about displaying content. It’s about having a URL to contain an item id, which is needed if user wants to share link to a specific item, and not the entire app.
…with the exception, of course, of Bubble’s built-in “send data to page” functionality, in which case the unique ID is sent as a path param without the page reloading. (See response above.)