Internal Bubble Page re-direct

Here’s the page URL as it stands, with the lovely ID number at the end.
https://oeuvre.gallery/minisite/jd-holden-1463822803662x1078558459350

Would it be possible to set up a redirect from

https://oeuvre.gallery/jd-holden

to the page that would actually have the data?
As a short term work around??

1 Like

Don’t see why not. Can you do a “on page load” navigation to another page ?

right… but then I’d need to send the specific page details to load the correct artist… hmmmm…

Yeah, but you could have a table that has the pretty URL and the related thing, look it up and send it.

Bit clunky.

I’m trying anything I can to make the artist mini-site “separate but pulling the same data”… knowing that I can “API” from one app to another is interesting… but then I need a new app for each artist… which will cost a bob or two…

Or ten :slight_smile:

So I wonder if we can use the fact that bubble will still display a page that needs a thing passed even if it doesn’t exist.

So take you ugly URL above, take off the ID and it will still show the page just no data.

Can you then set the thing on page load ?

well… i did try that, but i wasn’t sure how to set the thing… and my “coder” said things like “that’s not how the internet works” … but what does she know??

Well, it kinda is.

Permalinks, semantic URLs, page slugs…

Ultimately they all pass something pretty to a page and it does the underlying query. Rather than pass a whole bunch of ugly parameters that identify the resource.

In English please… :stuck_out_tongue_winking_eye:

OK… so how do I set a Thing page load? I’ve got page load, but no way of setting a Thing…

So… this is really hacky - but it works !

What we have is “slug” defined on a thing.

For the moment the slug must be 8 characters long.

So we have the following URL…

https://buildingonbubble.com/version-test/block/testslug

On PageLoad we check to see if Bubble has loaded a thing … if it has we are fine.

Note that you can’t check to see if the Page Thing is empty, you need to check that it has a field that you know should be there.

Now …we also check that if bubble hasn’t loaded a thing, that the last 8 characters of the URL exist on the database against the slug.

If they do exist, then we re-navigate to the page with the matching thing.

What we want to avoid doing is looping bubble on the page loads, as then bad things happen. Hence we must check that the slug exists or we will just go round in a loop.

Also… you can’t debug this, as you then can’t get to the slug name you just get the debug bit.

I actually don’t think we are too far off a less hacky solution, we are just transferring the responsibility of setting the page thing from Bubble to the Programmer. If we could find a way to get the final part of the URL back as an :extract then it would be a lot tidier.

1 Like

Actually…there is another way to do this and it doesn’t need the messing about with the URL.

What appears to happen is that the “unique id” of a page with a thing passed to it in a “pretty” format is preserved in the unique id.

So…

Here is a page that takes the data type “Word”. Word Up.

The Page is “slugtest” and we are passing “Shorterword” in as a parameter.

Pass in whatever you like after the page name, and it appears in the “unique id” as is.

Then just look that Unique Id up on something and you have your pretty/semantic/permalink.

2 Likes

@NigelG So we at last have a moment to try and play with this.

We’re trying to understand the Slug concept, but can’t find out how to see what you have in the first image you posted in this thread. To be honest, we’re not even sure if we still need that as you said later [quote=“NigelG, post:11, topic:3343”]
another way to do this and it doesn’t need the messing about with the URL.
[/quote]

Could you point us in the right direction? Thanks

Can you make this app public so we can see how you did it?

Thanks!

Brilliant!

Here we go.

Currently playing with the Contentful API and noticed they have slugs too. Am not making this stuff up you know :slight_smile:

@Nigel we’re going to push on Monday a fix to a bug that your method was relying on. So you should change the system in one way (it’s quick).

Instead of getting the unique ID from the page’s thing (which doesn’t exist, that’s the bug: you shouldn’t have it…), use ‘Get data from URL’ and pick ‘Path’. That’ll do exactly the same, and it’s cleaner.

3 Likes

Thanks, a proper solution :slight_smile:

2 Likes

Im i bit lost here, i don’t know if this is the right thread but im going to try it…

In my service, users will signup and they have a “username” field on the Users data type. Is it posible to automatically assign that username as their unique url?

For example if i signup and entered “charlie” as my username, my profile link will be domainname.com/charlie

How can i achieve this?

You probably can’t do …

domainname.com/charlie

But you can certainly do …

domainname.com/users/charlie

In which case the page name is users, and on that page you will use “get path” to find charlie and search the database for that user and display their stuff.

1 Like